@moostjs/event-http 0.2.9 → 0.2.11

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.
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var eventHttp = require('@wooksjs/event-http');
4
4
  var moost = require('moost');
5
- require('@wooksjs/event-core');
5
+ var eventCore = require('@wooksjs/event-core');
6
6
 
7
7
  /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -335,21 +335,83 @@ function useBody() {
335
335
  * @decorator
336
336
  * @paramType TStatusHook
337
337
  */
338
- const StatusHook = moost.Resolve(() => eventHttp.useStatus(), 'status');
338
+ const StatusHook = () => moost.Resolve((metas, level) => {
339
+ const hook = eventHttp.useStatus();
340
+ if (level === 'PARAM') {
341
+ return hook;
342
+ }
343
+ if (level === 'PROP' && metas.instance && metas.key) {
344
+ const initialValue = metas.instance[metas.key];
345
+ eventCore.attachHook(metas.instance, {
346
+ get: () => hook.value,
347
+ set: (v) => hook.value = v,
348
+ }, metas.key);
349
+ return typeof initialValue === 'number' ? initialValue : 200;
350
+ }
351
+ }, 'statusCode');
339
352
  /**
340
353
  * Hook to the Response Header
341
354
  * @decorator
342
355
  * @param name - header name
343
356
  * @paramType THeaderHook
344
357
  */
345
- const HeaderHook = (name) => moost.Resolve(() => eventHttp.useSetHeader(name), name);
358
+ const HeaderHook = (name) => moost.Resolve((metas, level) => {
359
+ const hook = eventHttp.useSetHeader(name);
360
+ if (level === 'PARAM') {
361
+ return hook;
362
+ }
363
+ if (level === 'PROP' && metas.instance && metas.key) {
364
+ const initialValue = metas.instance[metas.key];
365
+ eventCore.attachHook(metas.instance, {
366
+ get: () => hook.value,
367
+ set: (v) => hook.value = v,
368
+ }, metas.key);
369
+ return typeof initialValue === 'string' ? initialValue : '';
370
+ }
371
+ }, name);
346
372
  /**
347
373
  * Hook to the Response Cookie
348
374
  * @decorator
349
- * @param name - header name
375
+ * @param name - cookie name
376
+ * @paramType TCookieHook
377
+ */
378
+ const CookieHook = (name) => moost.Resolve((metas, level) => {
379
+ const hook = eventHttp.useSetCookie(name);
380
+ if (level === 'PARAM') {
381
+ return hook;
382
+ }
383
+ if (level === 'PROP' && metas.instance && metas.key) {
384
+ const initialValue = metas.instance[metas.key];
385
+ eventCore.attachHook(metas.instance, {
386
+ get: () => hook.value,
387
+ set: (v) => hook.value = v,
388
+ }, metas.key);
389
+ return typeof initialValue === 'string' ? initialValue : '';
390
+ }
391
+ }, name);
392
+ /**
393
+ * Hook to the Response Cookie Attributes
394
+ * @decorator
395
+ * @param name - cookie name
350
396
  * @paramType TCookieHook
351
397
  */
352
- const CookieHook = (name) => moost.Resolve(() => eventHttp.useSetCookie(name), name);
398
+ const CookieAttrsHook = (name) => moost.Resolve((metas, level) => {
399
+ const hook = eventHttp.useSetCookie(name);
400
+ if (level === 'PARAM') {
401
+ return eventCore.attachHook({}, {
402
+ get: () => hook.attrs,
403
+ set: (v) => hook.attrs = v,
404
+ });
405
+ }
406
+ if (level === 'PROP' && metas.instance && metas.key) {
407
+ const initialValue = metas.instance[metas.key];
408
+ eventCore.attachHook(metas.instance, {
409
+ get: () => hook.attrs,
410
+ set: (v) => hook.attrs = v,
411
+ }, metas.key);
412
+ return typeof initialValue === 'object' ? initialValue : {};
413
+ }
414
+ }, name);
353
415
  /**
354
416
  * Parse Authorisation Header
355
417
  * @decorator
@@ -407,7 +469,6 @@ function Query(name) {
407
469
  if (name) {
408
470
  const p = urlSearchParams();
409
471
  const value = p.get(name);
410
- console.log(name + ' = ', value);
411
472
  return value === '' && p.has(name) || value;
412
473
  }
413
474
  const json = jsonSearchParams();
@@ -588,6 +649,17 @@ class Mate {
588
649
  data = data.params[index];
589
650
  }
590
651
  }
652
+ else if (!index && !args.descriptor && args.propKey && this.options.collectPropKeys && args.level !== 'CLASS') {
653
+ this.set({ ...args, level: 'CLASS' }, (meta) => {
654
+ if (!meta.properties) {
655
+ meta.properties = [args.propKey];
656
+ }
657
+ else if (!meta.properties.includes(args.propKey)) {
658
+ meta.properties.push(args.propKey);
659
+ }
660
+ return meta;
661
+ });
662
+ }
591
663
  if (typeof key !== 'function') {
592
664
  if (isArray) {
593
665
  const newArray = (data[key] || []);
@@ -662,11 +734,35 @@ const METADATA_WORKSPACE = 'moost';
662
734
  const moostMate = new Mate(METADATA_WORKSPACE, {
663
735
  readType: true,
664
736
  readReturnType: true,
737
+ collectPropKeys: true,
665
738
  });
666
739
  function getMoostMate() {
667
740
  return moostMate;
668
741
  }
669
742
 
743
+ getMoostMate().decorate((meta) => {
744
+ if (!meta.injectable)
745
+ meta.injectable = true;
746
+ return meta;
747
+ });
748
+
749
+ var TInterceptorPriority;
750
+ (function (TInterceptorPriority) {
751
+ TInterceptorPriority[TInterceptorPriority["BEFORE_ALL"] = 0] = "BEFORE_ALL";
752
+ TInterceptorPriority[TInterceptorPriority["BEFORE_GUARD"] = 1] = "BEFORE_GUARD";
753
+ TInterceptorPriority[TInterceptorPriority["GUARD"] = 2] = "GUARD";
754
+ TInterceptorPriority[TInterceptorPriority["AFTER_GUARD"] = 3] = "AFTER_GUARD";
755
+ TInterceptorPriority[TInterceptorPriority["INTERCEPTOR"] = 4] = "INTERCEPTOR";
756
+ TInterceptorPriority[TInterceptorPriority["CATCH_ERROR"] = 5] = "CATCH_ERROR";
757
+ TInterceptorPriority[TInterceptorPriority["AFTER_ALL"] = 6] = "AFTER_ALL";
758
+ })(TInterceptorPriority || (TInterceptorPriority = {}));
759
+ function Intercept(handler, priority) {
760
+ return getMoostMate().decorate('interceptors', {
761
+ handler,
762
+ priority: priority || handler.priority || TInterceptorPriority.INTERCEPTOR,
763
+ }, true);
764
+ }
765
+
670
766
  var TPipePriority;
671
767
  (function (TPipePriority) {
672
768
  TPipePriority[TPipePriority["BEFORE_RESOLVE"] = 0] = "BEFORE_RESOLVE";
@@ -680,9 +776,23 @@ var TPipePriority;
680
776
  TPipePriority[TPipePriority["AFTER_VALIDATE"] = 8] = "AFTER_VALIDATE";
681
777
  })(TPipePriority || (TPipePriority = {}));
682
778
 
683
- const resolvePipe = (_value, meta) => {
684
- if (meta === null || meta === void 0 ? void 0 : meta.resolver) {
685
- return meta.resolver();
779
+ const resolvePipe = (_value, metas, level) => {
780
+ var _a, _b, _c, _d;
781
+ let resolver;
782
+ if (level === 'PARAM') {
783
+ resolver = (_a = metas.paramMeta) === null || _a === void 0 ? void 0 : _a.resolver;
784
+ }
785
+ else if (level === 'PROP') {
786
+ resolver = (_b = metas.propMeta) === null || _b === void 0 ? void 0 : _b.resolver;
787
+ }
788
+ else if (level === 'METHOD') {
789
+ resolver = (_c = metas.methodMeta) === null || _c === void 0 ? void 0 : _c.resolver;
790
+ }
791
+ else if (level === 'CLASS') {
792
+ resolver = (_d = metas.classMeta) === null || _d === void 0 ? void 0 : _d.resolver;
793
+ }
794
+ if (resolver) {
795
+ return resolver(metas, level);
686
796
  }
687
797
  return undefined;
688
798
  };
@@ -695,29 +805,6 @@ resolvePipe.priority = TPipePriority.RESOLVE;
695
805
  },
696
806
  ];
697
807
 
698
- getMoostMate().decorate((meta) => {
699
- if (!meta.injectable)
700
- meta.injectable = true;
701
- return meta;
702
- });
703
-
704
- var TInterceptorPriority;
705
- (function (TInterceptorPriority) {
706
- TInterceptorPriority[TInterceptorPriority["BEFORE_ALL"] = 0] = "BEFORE_ALL";
707
- TInterceptorPriority[TInterceptorPriority["BEFORE_GUARD"] = 1] = "BEFORE_GUARD";
708
- TInterceptorPriority[TInterceptorPriority["GUARD"] = 2] = "GUARD";
709
- TInterceptorPriority[TInterceptorPriority["AFTER_GUARD"] = 3] = "AFTER_GUARD";
710
- TInterceptorPriority[TInterceptorPriority["INTERCEPTOR"] = 4] = "INTERCEPTOR";
711
- TInterceptorPriority[TInterceptorPriority["CATCH_ERROR"] = 5] = "CATCH_ERROR";
712
- TInterceptorPriority[TInterceptorPriority["AFTER_ALL"] = 6] = "AFTER_ALL";
713
- })(TInterceptorPriority || (TInterceptorPriority = {}));
714
- function Intercept(handler, priority) {
715
- return getMoostMate().decorate('interceptors', {
716
- handler,
717
- priority: priority || handler.priority || TInterceptorPriority.INTERCEPTOR,
718
- }, true);
719
- }
720
-
721
808
  const setHeaderInterceptor = (name, value, opts) => {
722
809
  const fn = (before, after, onError) => {
723
810
  const h = eventHttp.useSetHeader(name);
@@ -754,6 +841,7 @@ exports.All = All;
754
841
  exports.Authorization = Authorization;
755
842
  exports.Body = Body;
756
843
  exports.Cookie = Cookie;
844
+ exports.CookieAttrsHook = CookieAttrsHook;
757
845
  exports.CookieHook = CookieHook;
758
846
  exports.Delete = Delete;
759
847
  exports.Get = Get;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { IncomingMessage } from 'http';
4
4
  import { ServerResponse } from 'http';
5
+ import { TCookieAttributesInput } from '@wooksjs/event-http';
5
6
  import { TInterceptorFn } from '@moostjs/moost';
6
7
  import { TMoostAdapter } from 'moost';
7
8
  import { TMoostAdapterOptions } from 'moost';
@@ -19,14 +20,14 @@ export declare const All: (path?: string) => MethodDecorator;
19
20
  * @param name - define what to take from the Auth header
20
21
  * @paramType string
21
22
  */
22
- export declare function Authorization(name: 'username' | 'password' | 'bearer' | 'raw' | 'type'): ParameterDecorator;
23
+ export declare function Authorization(name: 'username' | 'password' | 'bearer' | 'raw' | 'type'): ParameterDecorator & PropertyDecorator;
23
24
 
24
25
  /**
25
26
  * Get Parsed Request Body
26
27
  * @decorator
27
28
  * @paramType object | string | unknown
28
29
  */
29
- declare function Body_2(): ParameterDecorator;
30
+ declare function Body_2(): ParameterDecorator & PropertyDecorator;
30
31
  export { Body_2 as Body }
31
32
 
32
33
  /**
@@ -35,15 +36,23 @@ export { Body_2 as Body }
35
36
  * @param name - cookie name
36
37
  * @paramType string
37
38
  */
38
- export declare function Cookie(name: string): ParameterDecorator;
39
+ export declare function Cookie(name: string): ParameterDecorator & PropertyDecorator;
40
+
41
+ /**
42
+ * Hook to the Response Cookie Attributes
43
+ * @decorator
44
+ * @param name - cookie name
45
+ * @paramType TCookieHook
46
+ */
47
+ export declare const CookieAttrsHook: (name: string) => ParameterDecorator & PropertyDecorator;
39
48
 
40
49
  /**
41
50
  * Hook to the Response Cookie
42
51
  * @decorator
43
- * @param name - header name
52
+ * @param name - cookie name
44
53
  * @paramType TCookieHook
45
54
  */
46
- export declare const CookieHook: (name: string) => ParameterDecorator;
55
+ export declare const CookieHook: (name: string) => ParameterDecorator & PropertyDecorator;
47
56
 
48
57
  export declare const Delete: (path?: string) => MethodDecorator;
49
58
 
@@ -55,7 +64,7 @@ export declare const Get: (path?: string) => MethodDecorator;
55
64
  * @param name - header name
56
65
  * @paramType string
57
66
  */
58
- export declare function Header(name: string): ParameterDecorator;
67
+ export declare function Header(name: string): ParameterDecorator & PropertyDecorator;
59
68
 
60
69
  /**
61
70
  * Hook to the Response Header
@@ -63,7 +72,7 @@ export declare function Header(name: string): ParameterDecorator;
63
72
  * @param name - header name
64
73
  * @paramType THeaderHook
65
74
  */
66
- export declare const HeaderHook: (name: string) => ParameterDecorator;
75
+ export declare const HeaderHook: (name: string) => ParameterDecorator & PropertyDecorator;
67
76
 
68
77
  export declare function HttpMethod(method: '*' | 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS', path?: string): MethodDecorator;
69
78
 
@@ -74,21 +83,21 @@ export declare function HttpMethod(method: '*' | 'GET' | 'PUT' | 'POST' | 'PATCH
74
83
  */
75
84
  export declare function Ip(opts?: {
76
85
  trustProxy: boolean;
77
- }): ParameterDecorator;
86
+ }): ParameterDecorator & PropertyDecorator;
78
87
 
79
88
  /**
80
89
  * Get Request IP Address list
81
90
  * @decorator
82
91
  * @paramType string[]
83
92
  */
84
- export declare function IpList(): ParameterDecorator;
93
+ export declare function IpList(): ParameterDecorator & PropertyDecorator;
85
94
 
86
95
  /**
87
96
  * Get Requested HTTP Method
88
97
  * @decorator
89
98
  * @paramType string
90
99
  */
91
- export declare function Method(): ParameterDecorator;
100
+ export declare function Method(): ParameterDecorator & PropertyDecorator;
92
101
 
93
102
  export declare class MoostHttp implements TMoostAdapter<THttpHandlerMeta> {
94
103
  protected httpApp: WooksHttp;
@@ -128,21 +137,21 @@ export declare function Query(name?: string): ParameterDecorator;
128
137
  * @decorator
129
138
  * @paramType Promise<Buffer>
130
139
  */
131
- export declare function RawBody(): ParameterDecorator;
140
+ export declare function RawBody(): ParameterDecorator & PropertyDecorator;
132
141
 
133
142
  /**
134
143
  * Get Raw Request Instance
135
144
  * @decorator
136
145
  * @paramType IncomingMessage
137
146
  */
138
- export declare function Req(): ParameterDecorator;
147
+ export declare function Req(): ParameterDecorator & PropertyDecorator;
139
148
 
140
149
  /**
141
150
  * Get Request Unique Identificator (UUID)
142
151
  * @decorator
143
152
  * @paramType string
144
153
  */
145
- export declare function ReqId(): ParameterDecorator;
154
+ export declare function ReqId(): ParameterDecorator & PropertyDecorator;
146
155
 
147
156
  /**
148
157
  * Get Raw Response Object
@@ -152,7 +161,7 @@ export declare function ReqId(): ParameterDecorator;
152
161
  */
153
162
  export declare function Res(options?: {
154
163
  passthrough: boolean;
155
- }): ParameterDecorator;
164
+ }): ParameterDecorator & PropertyDecorator;
156
165
 
157
166
  export declare function SetCookie(...args: Parameters<typeof setCookieInterceptor>): ClassDecorator & MethodDecorator;
158
167
 
@@ -170,7 +179,9 @@ declare const setHeaderInterceptor: (name: string, value: string, opts?: {
170
179
  * @decorator
171
180
  * @paramType TStatusHook
172
181
  */
173
- export declare const StatusHook: ParameterDecorator;
182
+ export declare const StatusHook: () => ParameterDecorator & PropertyDecorator;
183
+
184
+ export { TCookieAttributesInput }
174
185
 
175
186
  export declare interface THttpHandlerMeta {
176
187
  method: string;
@@ -182,6 +193,6 @@ export declare interface THttpHandlerMeta {
182
193
  * @decorator
183
194
  * @paramType string
184
195
  */
185
- export declare function Url(): ParameterDecorator;
196
+ export declare function Url(): ParameterDecorator & PropertyDecorator;
186
197
 
187
198
  export { }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WooksHttp, createHttpApp, useHttpContext, useRequest, useHeaders, HttpError, EHttpStatusCode, WooksURLSearchParams, useStatus, useSetHeader, useSetCookie, useAuthorization, useCookies, useSearchParams, useResponse, useSetCookies } from '@wooksjs/event-http';
2
2
  import { getMoostMate as getMoostMate$1, Resolve } from 'moost';
3
- import '@wooksjs/event-core';
3
+ import { attachHook } from '@wooksjs/event-core';
4
4
 
5
5
  /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -333,21 +333,83 @@ function useBody() {
333
333
  * @decorator
334
334
  * @paramType TStatusHook
335
335
  */
336
- const StatusHook = Resolve(() => useStatus(), 'status');
336
+ const StatusHook = () => Resolve((metas, level) => {
337
+ const hook = useStatus();
338
+ if (level === 'PARAM') {
339
+ return hook;
340
+ }
341
+ if (level === 'PROP' && metas.instance && metas.key) {
342
+ const initialValue = metas.instance[metas.key];
343
+ attachHook(metas.instance, {
344
+ get: () => hook.value,
345
+ set: (v) => hook.value = v,
346
+ }, metas.key);
347
+ return typeof initialValue === 'number' ? initialValue : 200;
348
+ }
349
+ }, 'statusCode');
337
350
  /**
338
351
  * Hook to the Response Header
339
352
  * @decorator
340
353
  * @param name - header name
341
354
  * @paramType THeaderHook
342
355
  */
343
- const HeaderHook = (name) => Resolve(() => useSetHeader(name), name);
356
+ const HeaderHook = (name) => Resolve((metas, level) => {
357
+ const hook = useSetHeader(name);
358
+ if (level === 'PARAM') {
359
+ return hook;
360
+ }
361
+ if (level === 'PROP' && metas.instance && metas.key) {
362
+ const initialValue = metas.instance[metas.key];
363
+ attachHook(metas.instance, {
364
+ get: () => hook.value,
365
+ set: (v) => hook.value = v,
366
+ }, metas.key);
367
+ return typeof initialValue === 'string' ? initialValue : '';
368
+ }
369
+ }, name);
344
370
  /**
345
371
  * Hook to the Response Cookie
346
372
  * @decorator
347
- * @param name - header name
373
+ * @param name - cookie name
374
+ * @paramType TCookieHook
375
+ */
376
+ const CookieHook = (name) => Resolve((metas, level) => {
377
+ const hook = useSetCookie(name);
378
+ if (level === 'PARAM') {
379
+ return hook;
380
+ }
381
+ if (level === 'PROP' && metas.instance && metas.key) {
382
+ const initialValue = metas.instance[metas.key];
383
+ attachHook(metas.instance, {
384
+ get: () => hook.value,
385
+ set: (v) => hook.value = v,
386
+ }, metas.key);
387
+ return typeof initialValue === 'string' ? initialValue : '';
388
+ }
389
+ }, name);
390
+ /**
391
+ * Hook to the Response Cookie Attributes
392
+ * @decorator
393
+ * @param name - cookie name
348
394
  * @paramType TCookieHook
349
395
  */
350
- const CookieHook = (name) => Resolve(() => useSetCookie(name), name);
396
+ const CookieAttrsHook = (name) => Resolve((metas, level) => {
397
+ const hook = useSetCookie(name);
398
+ if (level === 'PARAM') {
399
+ return attachHook({}, {
400
+ get: () => hook.attrs,
401
+ set: (v) => hook.attrs = v,
402
+ });
403
+ }
404
+ if (level === 'PROP' && metas.instance && metas.key) {
405
+ const initialValue = metas.instance[metas.key];
406
+ attachHook(metas.instance, {
407
+ get: () => hook.attrs,
408
+ set: (v) => hook.attrs = v,
409
+ }, metas.key);
410
+ return typeof initialValue === 'object' ? initialValue : {};
411
+ }
412
+ }, name);
351
413
  /**
352
414
  * Parse Authorisation Header
353
415
  * @decorator
@@ -405,7 +467,6 @@ function Query(name) {
405
467
  if (name) {
406
468
  const p = urlSearchParams();
407
469
  const value = p.get(name);
408
- console.log(name + ' = ', value);
409
470
  return value === '' && p.has(name) || value;
410
471
  }
411
472
  const json = jsonSearchParams();
@@ -586,6 +647,17 @@ class Mate {
586
647
  data = data.params[index];
587
648
  }
588
649
  }
650
+ else if (!index && !args.descriptor && args.propKey && this.options.collectPropKeys && args.level !== 'CLASS') {
651
+ this.set({ ...args, level: 'CLASS' }, (meta) => {
652
+ if (!meta.properties) {
653
+ meta.properties = [args.propKey];
654
+ }
655
+ else if (!meta.properties.includes(args.propKey)) {
656
+ meta.properties.push(args.propKey);
657
+ }
658
+ return meta;
659
+ });
660
+ }
589
661
  if (typeof key !== 'function') {
590
662
  if (isArray) {
591
663
  const newArray = (data[key] || []);
@@ -660,11 +732,35 @@ const METADATA_WORKSPACE = 'moost';
660
732
  const moostMate = new Mate(METADATA_WORKSPACE, {
661
733
  readType: true,
662
734
  readReturnType: true,
735
+ collectPropKeys: true,
663
736
  });
664
737
  function getMoostMate() {
665
738
  return moostMate;
666
739
  }
667
740
 
741
+ getMoostMate().decorate((meta) => {
742
+ if (!meta.injectable)
743
+ meta.injectable = true;
744
+ return meta;
745
+ });
746
+
747
+ var TInterceptorPriority;
748
+ (function (TInterceptorPriority) {
749
+ TInterceptorPriority[TInterceptorPriority["BEFORE_ALL"] = 0] = "BEFORE_ALL";
750
+ TInterceptorPriority[TInterceptorPriority["BEFORE_GUARD"] = 1] = "BEFORE_GUARD";
751
+ TInterceptorPriority[TInterceptorPriority["GUARD"] = 2] = "GUARD";
752
+ TInterceptorPriority[TInterceptorPriority["AFTER_GUARD"] = 3] = "AFTER_GUARD";
753
+ TInterceptorPriority[TInterceptorPriority["INTERCEPTOR"] = 4] = "INTERCEPTOR";
754
+ TInterceptorPriority[TInterceptorPriority["CATCH_ERROR"] = 5] = "CATCH_ERROR";
755
+ TInterceptorPriority[TInterceptorPriority["AFTER_ALL"] = 6] = "AFTER_ALL";
756
+ })(TInterceptorPriority || (TInterceptorPriority = {}));
757
+ function Intercept(handler, priority) {
758
+ return getMoostMate().decorate('interceptors', {
759
+ handler,
760
+ priority: priority || handler.priority || TInterceptorPriority.INTERCEPTOR,
761
+ }, true);
762
+ }
763
+
668
764
  var TPipePriority;
669
765
  (function (TPipePriority) {
670
766
  TPipePriority[TPipePriority["BEFORE_RESOLVE"] = 0] = "BEFORE_RESOLVE";
@@ -678,9 +774,23 @@ var TPipePriority;
678
774
  TPipePriority[TPipePriority["AFTER_VALIDATE"] = 8] = "AFTER_VALIDATE";
679
775
  })(TPipePriority || (TPipePriority = {}));
680
776
 
681
- const resolvePipe = (_value, meta) => {
682
- if (meta === null || meta === void 0 ? void 0 : meta.resolver) {
683
- return meta.resolver();
777
+ const resolvePipe = (_value, metas, level) => {
778
+ var _a, _b, _c, _d;
779
+ let resolver;
780
+ if (level === 'PARAM') {
781
+ resolver = (_a = metas.paramMeta) === null || _a === void 0 ? void 0 : _a.resolver;
782
+ }
783
+ else if (level === 'PROP') {
784
+ resolver = (_b = metas.propMeta) === null || _b === void 0 ? void 0 : _b.resolver;
785
+ }
786
+ else if (level === 'METHOD') {
787
+ resolver = (_c = metas.methodMeta) === null || _c === void 0 ? void 0 : _c.resolver;
788
+ }
789
+ else if (level === 'CLASS') {
790
+ resolver = (_d = metas.classMeta) === null || _d === void 0 ? void 0 : _d.resolver;
791
+ }
792
+ if (resolver) {
793
+ return resolver(metas, level);
684
794
  }
685
795
  return undefined;
686
796
  };
@@ -693,29 +803,6 @@ resolvePipe.priority = TPipePriority.RESOLVE;
693
803
  },
694
804
  ];
695
805
 
696
- getMoostMate().decorate((meta) => {
697
- if (!meta.injectable)
698
- meta.injectable = true;
699
- return meta;
700
- });
701
-
702
- var TInterceptorPriority;
703
- (function (TInterceptorPriority) {
704
- TInterceptorPriority[TInterceptorPriority["BEFORE_ALL"] = 0] = "BEFORE_ALL";
705
- TInterceptorPriority[TInterceptorPriority["BEFORE_GUARD"] = 1] = "BEFORE_GUARD";
706
- TInterceptorPriority[TInterceptorPriority["GUARD"] = 2] = "GUARD";
707
- TInterceptorPriority[TInterceptorPriority["AFTER_GUARD"] = 3] = "AFTER_GUARD";
708
- TInterceptorPriority[TInterceptorPriority["INTERCEPTOR"] = 4] = "INTERCEPTOR";
709
- TInterceptorPriority[TInterceptorPriority["CATCH_ERROR"] = 5] = "CATCH_ERROR";
710
- TInterceptorPriority[TInterceptorPriority["AFTER_ALL"] = 6] = "AFTER_ALL";
711
- })(TInterceptorPriority || (TInterceptorPriority = {}));
712
- function Intercept(handler, priority) {
713
- return getMoostMate().decorate('interceptors', {
714
- handler,
715
- priority: priority || handler.priority || TInterceptorPriority.INTERCEPTOR,
716
- }, true);
717
- }
718
-
719
806
  const setHeaderInterceptor = (name, value, opts) => {
720
807
  const fn = (before, after, onError) => {
721
808
  const h = useSetHeader(name);
@@ -748,4 +835,4 @@ function SetCookie(...args) {
748
835
  return Intercept(setCookieInterceptor(...args));
749
836
  }
750
837
 
751
- export { All, Authorization, Body, Cookie, CookieHook, Delete, Get, Header, HeaderHook, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, StatusHook, Url };
838
+ export { All, Authorization, Body, Cookie, CookieAttrsHook, CookieHook, Delete, Get, Header, HeaderHook, HttpMethod, Ip, IpList, Method, MoostHttp, Patch, Post, Put, Query, RawBody, Req, ReqId, Res, SetCookie, SetHeader, StatusHook, Url };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/event-http",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "@moostjs/event-http",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-http#readme",
30
30
  "peerDependencies": {
31
- "moost": "0.2.9",
32
- "wooks": "^0.2.5",
33
- "@wooksjs/event-core": "^0.2.5"
31
+ "moost": "0.2.11",
32
+ "wooks": "^0.2.6",
33
+ "@wooksjs/event-core": "^0.2.6"
34
34
  },
35
35
  "dependencies": {
36
- "@wooksjs/event-http": "^0.2.5"
36
+ "@wooksjs/event-http": "^0.2.6"
37
37
  }
38
38
  }