@heliosjs/middlewares 8.0.0 → 9.0.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.
package/dist/catch.js CHANGED
@@ -31,7 +31,7 @@ const utils_1 = require("@heliosjs/core/utils");
31
31
  */
32
32
  function Catch(handler) {
33
33
  return function (target, propertyKey, descriptor) {
34
- const data = { errors: [handler] };
34
+ const data = [{ errorHandler: handler }];
35
35
  if (descriptor) {
36
36
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
37
37
  }
package/dist/catch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"catch.js","sourceRoot":"","sources":["../src/catch.ts"],"names":[],"mappings":";;AA6BA,sBAUC;AAtCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,KAAK,CAAC,OAAqB;IACzC,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QAEnC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"catch.js","sourceRoot":"","sources":["../src/catch.ts"],"names":[],"mappings":";;AA6BA,sBAUC;AAtCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,KAAK,CAAC,OAAqB;IACzC,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC;QAEzC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/dist/cors.js CHANGED
@@ -46,7 +46,7 @@ function Cors(config = {}) {
46
46
  methods: Object.keys(types_1.HTTP_METHODS),
47
47
  };
48
48
  const finalConfig = { ...defaultConfig, ...config };
49
- const data = { cors: [finalConfig] };
49
+ const data = [{ cors: finalConfig }];
50
50
  if (descriptor) {
51
51
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
52
52
  }
package/dist/cors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cors.js","sourceRoot":"","sources":["../src/cors.ts"],"names":[],"mappings":";;AAqCA,oBAkBC;AAvDD,gDAAgE;AAChE,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAgB,IAAI,CAAC,SAAqB,EAAE;IAC1C,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,aAAa,GAAe;YAChC,MAAM,EAAE,GAAG;YACX,oBAAoB,EAAE,GAAG;YACzB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAY,CAAC;SACnC,CAAC;QAEF,MAAM,WAAW,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC;QAEpD,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;QAErC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"cors.js","sourceRoot":"","sources":["../src/cors.ts"],"names":[],"mappings":";;AAqCA,oBAkBC;AAvDD,gDAAgE;AAChE,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAgB,IAAI,CAAC,SAAqB,EAAE;IAC1C,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,aAAa,GAAe;YAChC,MAAM,EAAE,GAAG;YACX,oBAAoB,EAAE,GAAG;YACzB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAY,CAAC;SACnC,CAAC;QAEF,MAAM,WAAW,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC;QAEpD,MAAM,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QAErC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/dist/guard.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Guard, GuardFn } from '@heliosjs/core/types';
1
+ import { type GuardClass, GuardFunction } from '@heliosjs/core/types';
2
2
  /**
3
3
  * Decorator to register a guard.
4
4
  *
@@ -13,7 +13,7 @@ import { type Guard, GuardFn } from '@heliosjs/core/types';
13
13
  *
14
14
  * @example
15
15
  * // Using function guard
16
- * @Guard((req, res) => {
16
+ * @GuardClass((req, res) => {
17
17
  * return !!req.headers.authorization;
18
18
  * })
19
19
  * class MyController {}
@@ -26,7 +26,7 @@ import { type Guard, GuardFn } from '@heliosjs/core/types';
26
26
  * }
27
27
  * }
28
28
  *
29
- * @Guard(AuthGuard)
29
+ * @GuardClass(AuthGuard)
30
30
  * class MyController {}
31
31
  *
32
32
  * @remarks
@@ -38,7 +38,7 @@ import { type Guard, GuardFn } from '@heliosjs/core/types';
38
38
  *
39
39
  * If any guard returns `false`, the request handling is stopped.
40
40
  *
41
- * Metadata is stored under the CONTROLLER_CONFIGUARTION key and used
41
+ * Metadata is stored under the CONTROLLER_CONFIGURATION key and used
42
42
  * internally by the framework during request processing.
43
43
  */
44
- export declare function Guard(guard: Guard | GuardFn): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
44
+ export declare function Guard(guard: GuardClass | GuardFunction): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
package/dist/guard.js CHANGED
@@ -16,7 +16,7 @@ const utils_1 = require("@heliosjs/core/utils");
16
16
  *
17
17
  * @example
18
18
  * // Using function guard
19
- * @Guard((req, res) => {
19
+ * @GuardClass((req, res) => {
20
20
  * return !!req.headers.authorization;
21
21
  * })
22
22
  * class MyController {}
@@ -29,7 +29,7 @@ const utils_1 = require("@heliosjs/core/utils");
29
29
  * }
30
30
  * }
31
31
  *
32
- * @Guard(AuthGuard)
32
+ * @GuardClass(AuthGuard)
33
33
  * class MyController {}
34
34
  *
35
35
  * @remarks
@@ -41,12 +41,12 @@ const utils_1 = require("@heliosjs/core/utils");
41
41
  *
42
42
  * If any guard returns `false`, the request handling is stopped.
43
43
  *
44
- * Metadata is stored under the CONTROLLER_CONFIGUARTION key and used
44
+ * Metadata is stored under the CONTROLLER_CONFIGURATION key and used
45
45
  * internally by the framework during request processing.
46
46
  */
47
47
  function Guard(guard) {
48
48
  return function (target, propertyKey, descriptor) {
49
- const data = { guards: [guard] };
49
+ const data = [{ guard: guard }];
50
50
  if (descriptor) {
51
51
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
52
52
  }
package/dist/guard.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":";;AA4CA,sBAUC;AArDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,SAAgB,KAAK,CAAC,KAAsB;IAC1C,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QAEjC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":";;AA4CA,sBAUC;AArDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,SAAgB,KAAK,CAAC,KAAiC;IACrD,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -42,4 +42,4 @@ import { InterceptorCB } from '@heliosjs/core/types';
42
42
  * Metadata is stored using the MIDDLEWARES_CONFIG key and
43
43
  * used internally by the framework during request processing.
44
44
  */
45
- export declare function Intercept(handler: InterceptorCB): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
45
+ export declare function Intercept(interceptor: InterceptorCB): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
@@ -45,9 +45,9 @@ const utils_1 = require("@heliosjs/core/utils");
45
45
  * Metadata is stored using the MIDDLEWARES_CONFIG key and
46
46
  * used internally by the framework during request processing.
47
47
  */
48
- function Intercept(handler) {
48
+ function Intercept(interceptor) {
49
49
  return function (target, propertyKey, descriptor) {
50
- const data = { interceptors: [handler] };
50
+ const data = [{ interceptor }];
51
51
  if (descriptor) {
52
52
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interceptor.js","sourceRoot":"","sources":["../src/interceptor.ts"],"names":[],"mappings":";;AA6CA,8BAUC;AAtDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,SAAgB,SAAS,CAAC,OAAsB;IAC9C,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QAEzC,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"interceptor.js","sourceRoot":"","sources":["../src/interceptor.ts"],"names":[],"mappings":";;AA6CA,8BAUC;AAtDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,SAAgB,SAAS,CAAC,WAA0B;IAClD,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;QAE/B,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/dist/pipe.d.ts CHANGED
@@ -25,7 +25,7 @@ import { type Pipe } from '@heliosjs/core/types';
25
25
  * - type casting
26
26
  * - sanitization
27
27
  *
28
- * Metadata is stored under the CONTROLLER_CONFIGUARTION key and later used
28
+ * Metadata is stored under the CONTROLLER_CONFIGURATION key and later used
29
29
  * by the framework during request processing.
30
30
  */
31
31
  export declare function Pipe(pipe: Pipe): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
package/dist/pipe.js CHANGED
@@ -28,12 +28,12 @@ const utils_1 = require("@heliosjs/core/utils");
28
28
  * - type casting
29
29
  * - sanitization
30
30
  *
31
- * Metadata is stored under the CONTROLLER_CONFIGUARTION key and later used
31
+ * Metadata is stored under the CONTROLLER_CONFIGURATION key and later used
32
32
  * by the framework during request processing.
33
33
  */
34
34
  function Pipe(pipe) {
35
35
  return function (target, propertyKey, descriptor) {
36
- const data = { pipes: [pipe] };
36
+ const data = [{ pipe }];
37
37
  if (descriptor) {
38
38
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
39
39
  }
package/dist/pipe.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":";;AA+BA,oBAUC;AAxCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,IAAI,CAAC,IAAU;IAC7B,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAE/B,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":";;AA+BA,oBAUC;AAxCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,IAAI,CAAC,IAAU;IAC7B,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAExB,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -37,4 +37,4 @@ import { SanitizerConfig } from '@heliosjs/core/types';
37
37
  * This metadata is accessible via Reflect API and used internally by the framework
38
38
  * to apply sanitization logic.
39
39
  */
40
- export declare function Sanitize(sanitizeConfig: SanitizerConfig | SanitizerConfig[]): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
40
+ export declare function Sanitize(config: SanitizerConfig | SanitizerConfig[]): (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void;
package/dist/sanitize.js CHANGED
@@ -40,9 +40,10 @@ const utils_1 = require("@heliosjs/core/utils");
40
40
  * This metadata is accessible via Reflect API and used internally by the framework
41
41
  * to apply sanitization logic.
42
42
  */
43
- function Sanitize(sanitizeConfig) {
43
+ function Sanitize(config) {
44
44
  return function (target, propertyKey, descriptor) {
45
- const data = { sanitizers: Array.isArray(sanitizeConfig) ? sanitizeConfig : [sanitizeConfig] };
45
+ const sanitizers = Array.isArray(config) ? config : [config];
46
+ const data = sanitizers.map(sanitizer => ({ sanitizer }));
46
47
  if (descriptor) {
47
48
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
48
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":";;AAwCA,4BAUC;AAjDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,SAAgB,QAAQ,CAAC,cAAmD;IAC1E,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC;QAE/F,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":";;AAwCA,4BAWC;AAlDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,SAAgB,QAAQ,CAAC,MAA2C;IAClE,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAE1D,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/dist/status.js CHANGED
@@ -39,9 +39,7 @@ const utils_1 = require("@heliosjs/core/utils");
39
39
  function Status(status) {
40
40
  return function (target, propertyKey) {
41
41
  if (propertyKey) {
42
- const meta = (0, utils_1.reflectMiddlewaresMetadata)(target);
43
- meta.status = status;
44
- (0, utils_1.defineMiddlewaresMeta)(meta, target, propertyKey);
42
+ (0, utils_1.defineMiddlewaresMeta)([{ status }], target, propertyKey);
45
43
  }
46
44
  };
47
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":";;;AAkCA,wBAQC;AA1CD,gDAAyF;AACzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,MAAM,CAAC,MAAc;IACnC,OAAO,UAAU,MAAW,EAAE,WAAoB;QAChD,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,IAAA,kCAA0B,EAAC,MAAM,CAAC,CAAC;YAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACI,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAA1B,QAAA,KAAK,SAAqB;AAEvC;;;;;;;GAOG;AACI,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAA1B,QAAA,KAAK,SAAqB;AAEvC;;;;;;;;GAQG;AACI,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAA1B,QAAA,KAAK,SAAqB"}
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":";;;AAkCA,wBAMC;AAxCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,MAAM,CAAC,MAAc;IACnC,OAAO,UAAU,MAAW,EAAE,WAAoB;QAChD,IAAI,WAAW,EAAE,CAAC;YAChB,IAAA,6BAAqB,EAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACI,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAA1B,QAAA,KAAK,SAAqB;AAEvC;;;;;;;GAOG;AACI,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAA1B,QAAA,KAAK,SAAqB;AAEvC;;;;;;;;GAQG;AACI,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAA1B,QAAA,KAAK,SAAqB"}
package/dist/use.js CHANGED
@@ -49,8 +49,8 @@ const utils_1 = require("@heliosjs/core/utils");
49
49
  function Use(middleware) {
50
50
  return function (target, propertyKey, descriptor) {
51
51
  const middlewares = Array.isArray(middleware) ? middleware : [middleware];
52
- const data = { middlewares };
53
- if (descriptor) {
52
+ const data = middlewares.map(middleware => ({ middleware }));
53
+ if (propertyKey) {
54
54
  (0, utils_1.defineMiddlewaresMeta)(data, target, propertyKey);
55
55
  }
56
56
  else {
package/dist/use.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"use.js","sourceRoot":"","sources":["../src/use.ts"],"names":[],"mappings":";;AA+CA,kBAcC;AA5DD,gDAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,SAAgB,GAAG,CAAC,UAAyC;IAC3D,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAE1E,MAAM,IAAI,GAAG,EAAE,WAAW,EAAE,CAAC;QAE7B,IAAI,UAAU,EAAE,CAAC;YACf,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"use.js","sourceRoot":"","sources":["../src/use.ts"],"names":[],"mappings":";;AA+CA,kBAcC;AA5DD,gDAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,SAAgB,GAAG,CAAC,UAAyC;IAC3D,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,UAA+B;QACjF,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAE1E,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAE7D,IAAI,WAAW,EAAE,CAAC;YAChB,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heliosjs/middlewares",
3
- "version": "8.0.0",
3
+ "version": "9.0.1",
4
4
  "description": "Middlewares for @heliosjs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,6 @@
20
20
  "scripts": {
21
21
  "build": "yarn clean && tsc -p tsconfig.build.json",
22
22
  "clean": "rm -rf dist",
23
- "prepublishOnly": "yarn build",
24
23
  "publish:public": "yarn publish --access public --no-git-tag-version",
25
24
  "publish:patch": "yarn version --patch --no-git-tag-version && yarn publish --access public",
26
25
  "publish:minor": "yarn version --minor --no-git-tag-version && yarn publish --access public",
@@ -30,7 +29,7 @@
30
29
  "reflect-metadata": "^0.2.2"
31
30
  },
32
31
  "peerDependencies": {
33
- "@heliosjs/core": "^3.0.0",
32
+ "@heliosjs/core": "^3.1.1",
34
33
  "typescript": ">=4.0.0",
35
34
  "reflect-metadata": "^0.2.2",
36
35
  "@types/node": "^25.5.0"