@heliosjs/middlewares 10.0.7 → 10.0.8
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.d.ts +0 -2
- package/dist/catch.js +0 -2
- package/dist/catch.js.map +1 -1
- package/dist/cors.d.ts +0 -2
- package/dist/cors.js +0 -2
- package/dist/cors.js.map +1 -1
- package/dist/fingerprint.d.ts +2 -0
- package/dist/fingerprint.js.map +1 -1
- package/dist/guard.d.ts +0 -2
- package/dist/guard.js +0 -2
- package/dist/guard.js.map +1 -1
- package/dist/pipe.d.ts +0 -2
- package/dist/pipe.js +0 -2
- package/dist/pipe.js.map +1 -1
- package/dist/roles.d.ts +10 -0
- package/dist/roles.js +6 -0
- package/dist/roles.js.map +1 -1
- package/dist/sanitize.d.ts +0 -2
- package/dist/sanitize.js +0 -2
- package/dist/sanitize.js.map +1 -1
- package/dist/status.d.ts +0 -2
- package/dist/status.js +0 -2
- package/dist/status.js.map +1 -1
- package/dist/use.d.ts +1 -3
- package/dist/use.js +1 -3
- package/dist/use.js.map +1 -1
- package/package.json +2 -2
package/dist/catch.d.ts
CHANGED
|
@@ -21,12 +21,10 @@ import type { ErrorHandler } from '@heliosjs/core/types';
|
|
|
21
21
|
* @returns A class or method decorator.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* ```ts
|
|
25
24
|
* @Catch((err, req, res) => {
|
|
26
25
|
* if (err instanceof NotFoundError) return { error: 'not found', path: req.path };
|
|
27
26
|
* throw err; // let the framework handle everything else
|
|
28
27
|
* })
|
|
29
28
|
* class MyController {}
|
|
30
|
-
* ```
|
|
31
29
|
*/
|
|
32
30
|
export declare function Catch(handler: ErrorHandler): (target: any, propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
package/dist/catch.js
CHANGED
|
@@ -24,13 +24,11 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
24
24
|
* @returns A class or method decorator.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
-
* ```ts
|
|
28
27
|
* @Catch((err, req, res) => {
|
|
29
28
|
* if (err instanceof NotFoundError) return { error: 'not found', path: req.path };
|
|
30
29
|
* throw err; // let the framework handle everything else
|
|
31
30
|
* })
|
|
32
31
|
* class MyController {}
|
|
33
|
-
* ```
|
|
34
32
|
*/
|
|
35
33
|
function Catch(handler) {
|
|
36
34
|
return function (target, propertyKey, _descriptor) {
|
package/dist/catch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../src/catch.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../src/catch.ts"],"names":[],"mappings":";;AA8BA,sBAUC;AAvCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,KAAK,CAAC,OAAqB;IACzC,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,MAAM,IAAI,GAAG,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC;QAEzC,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;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/cors.d.ts
CHANGED
|
@@ -30,13 +30,11 @@ import type { CORSConfig } from '@heliosjs/core/types';
|
|
|
30
30
|
* @returns A class or method decorator.
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
|
-
* ```ts
|
|
34
33
|
* @Cors({
|
|
35
34
|
* origin: ['https://app.example.com'],
|
|
36
35
|
* methods: ['GET', 'POST'],
|
|
37
36
|
* credentials: true,
|
|
38
37
|
* })
|
|
39
38
|
* class ApiController {}
|
|
40
|
-
* ```
|
|
41
39
|
*/
|
|
42
40
|
export declare function Cors(config?: CORSConfig): (target: any, propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
package/dist/cors.js
CHANGED
|
@@ -34,14 +34,12 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
34
34
|
* @returns A class or method decorator.
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
|
-
* ```ts
|
|
38
37
|
* @Cors({
|
|
39
38
|
* origin: ['https://app.example.com'],
|
|
40
39
|
* methods: ['GET', 'POST'],
|
|
41
40
|
* credentials: true,
|
|
42
41
|
* })
|
|
43
42
|
* class ApiController {}
|
|
44
|
-
* ```
|
|
45
43
|
*/
|
|
46
44
|
function Cors(config = {}) {
|
|
47
45
|
return function (target, propertyKey, _descriptor) {
|
package/dist/cors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../src/cors.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../src/cors.ts"],"names":[],"mappings":";;AAyCA,oBAkBC;AA1DD,gDAAoD;AACpD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,SAAgB,IAAI,CAAC,SAAqB,EAAE;IAC1C,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,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,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;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/fingerprint.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { FingerprintComponent } from '@heliosjs/core/types';
|
|
2
|
+
/** Options for `@UseFingerprint`. */
|
|
2
3
|
export interface UseFingerprintOptions {
|
|
4
|
+
/** Component set to hash for this scope, overriding the configured/default set. See {@link FingerprintComponent}. */
|
|
3
5
|
components?: FingerprintComponent[];
|
|
4
6
|
}
|
|
5
7
|
/**
|
package/dist/fingerprint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":";;AAsBA,wCAeC;AAjCD,gDAAsF;AAQtF;;;;;;;;;GASG;AACH,SAAgB,cAAc,CAAC,UAAiC,EAAE;IAChE,MAAM,UAAU,GAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QACnD,IAAA,+BAAuB,EAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACjD,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,MAAM,IAAI,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAC9B,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;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/guard.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { type GuardClass } from '@heliosjs/core/types';
|
|
|
22
22
|
* @returns A class or method decorator.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
|
-
* ```ts
|
|
26
25
|
* @Guard((req) => !!req.getHeader('authorization') || 'Missing token')
|
|
27
26
|
* class SecureController {}
|
|
28
27
|
*
|
|
@@ -37,6 +36,5 @@ import { type GuardClass } from '@heliosjs/core/types';
|
|
|
37
36
|
* @Guard(RoleGuard)
|
|
38
37
|
* deleteEverything() {}
|
|
39
38
|
* }
|
|
40
|
-
* ```
|
|
41
39
|
*/
|
|
42
40
|
export declare function Guard(guard: GuardClass | GuardFunction | GuardInstance): (target: any, propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
package/dist/guard.js
CHANGED
|
@@ -24,7 +24,6 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
24
24
|
* @returns A class or method decorator.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
-
* ```ts
|
|
28
27
|
* @Guard((req) => !!req.getHeader('authorization') || 'Missing token')
|
|
29
28
|
* class SecureController {}
|
|
30
29
|
*
|
|
@@ -39,7 +38,6 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
39
38
|
* @Guard(RoleGuard)
|
|
40
39
|
* deleteEverything() {}
|
|
41
40
|
* }
|
|
42
|
-
* ```
|
|
43
41
|
*/
|
|
44
42
|
function Guard(guard) {
|
|
45
43
|
return function (target, propertyKey, _descriptor) {
|
package/dist/guard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":";;AAwCA,sBAUC;AAhDD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,KAAK,CAAC,KAAiD;IACrE,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhC,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;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/pipe.d.ts
CHANGED
|
@@ -23,12 +23,10 @@ import { type Pipe } from '@heliosjs/core/types';
|
|
|
23
23
|
* @returns A class or method decorator.
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
|
-
* ```ts
|
|
27
26
|
* @Pipe({
|
|
28
27
|
* body: (body) => ({ ...body, name: body.name?.trim() }),
|
|
29
28
|
* query: (query) => ({ ...query, page: Number(query.page ?? 1) }),
|
|
30
29
|
* })
|
|
31
30
|
* class MyController {}
|
|
32
|
-
* ```
|
|
33
31
|
*/
|
|
34
32
|
export declare function Pipe(pipe: Pipe): (target: any, propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
package/dist/pipe.js
CHANGED
|
@@ -26,13 +26,11 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
26
26
|
* @returns A class or method decorator.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
|
-
* ```ts
|
|
30
29
|
* @Pipe({
|
|
31
30
|
* body: (body) => ({ ...body, name: body.name?.trim() }),
|
|
32
31
|
* query: (query) => ({ ...query, page: Number(query.page ?? 1) }),
|
|
33
32
|
* })
|
|
34
33
|
* class MyController {}
|
|
35
|
-
* ```
|
|
36
34
|
*/
|
|
37
35
|
function Pipe(pipe) {
|
|
38
36
|
return function (target, propertyKey, _descriptor) {
|
package/dist/pipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../src/pipe.ts"],"names":[],"mappings":";;AAgCA,oBAUC;AAzCD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,IAAI,CAAC,IAAU;IAC7B,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,MAAM,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAExB,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;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/roles.d.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { GuardFunction } from '@heliosjs/core/types';
|
|
2
|
+
/** Role match policy for `@Roles`: `'any'` (at least one required role) or `'all'` (every required role). */
|
|
2
3
|
export type RoleMode = 'any' | 'all';
|
|
4
|
+
/** Trailing options object accepted by `@Roles`. */
|
|
3
5
|
export interface RolesOptions {
|
|
6
|
+
/** Match policy. Default `'any'`. */
|
|
4
7
|
mode?: RoleMode;
|
|
8
|
+
/** Denial message when the check fails. Default `'Insufficient role'`. */
|
|
5
9
|
message?: string;
|
|
6
10
|
}
|
|
7
11
|
type RolesArg = string | string[];
|
|
12
|
+
/**
|
|
13
|
+
* @internal `true` when `userRoles` satisfies `required` under `mode` (`'all'`:
|
|
14
|
+
* every required role present; otherwise: at least one).
|
|
15
|
+
*/
|
|
8
16
|
export declare function matchRoles(required: string[], userRoles: string[], mode: RoleMode): boolean;
|
|
17
|
+
/** @internal Splits `@Roles(...)`'s variadic arguments into a flat role list plus the trailing options object, if any. */
|
|
9
18
|
export declare function normalizeArgs(args: (RolesArg | RolesOptions)[]): {
|
|
10
19
|
roles: string[];
|
|
11
20
|
options: RolesOptions;
|
|
12
21
|
};
|
|
22
|
+
/** @internal Builds the `GuardFunction` `@Roles` registers via `@Guard`, using the configured `RolesExtractor`. */
|
|
13
23
|
export declare function createRolesGuard(required: string[], options: RolesOptions): GuardFunction;
|
|
14
24
|
/**
|
|
15
25
|
* Restrict a controller or route to users holding the required role(s).
|
package/dist/roles.js
CHANGED
|
@@ -5,11 +5,16 @@ exports.normalizeArgs = normalizeArgs;
|
|
|
5
5
|
exports.createRolesGuard = createRolesGuard;
|
|
6
6
|
exports.Roles = Roles;
|
|
7
7
|
const utils_1 = require("@heliosjs/core/utils");
|
|
8
|
+
/**
|
|
9
|
+
* @internal `true` when `userRoles` satisfies `required` under `mode` (`'all'`:
|
|
10
|
+
* every required role present; otherwise: at least one).
|
|
11
|
+
*/
|
|
8
12
|
function matchRoles(required, userRoles, mode) {
|
|
9
13
|
return mode === 'all'
|
|
10
14
|
? required.every((role) => userRoles.includes(role))
|
|
11
15
|
: required.some((role) => userRoles.includes(role));
|
|
12
16
|
}
|
|
17
|
+
/** @internal Splits `@Roles(...)`'s variadic arguments into a flat role list plus the trailing options object, if any. */
|
|
13
18
|
function normalizeArgs(args) {
|
|
14
19
|
let options = {};
|
|
15
20
|
let roleArgs = args;
|
|
@@ -28,6 +33,7 @@ function normalizeArgs(args) {
|
|
|
28
33
|
});
|
|
29
34
|
return { roles, options };
|
|
30
35
|
}
|
|
36
|
+
/** @internal Builds the `GuardFunction` `@Roles` registers via `@Guard`, using the configured `RolesExtractor`. */
|
|
31
37
|
function createRolesGuard(required, options) {
|
|
32
38
|
const mode = options.mode ?? 'any';
|
|
33
39
|
const message = options.message ?? 'Insufficient role';
|
package/dist/roles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../src/roles.ts"],"names":[],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AAqB,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/sanitize.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ import type { SanitizerConfig } from '@heliosjs/core/types';
|
|
|
23
23
|
* @returns A class or method decorator.
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
|
-
* ```ts
|
|
27
26
|
* @Sanitize({
|
|
28
27
|
* type: 'body',
|
|
29
28
|
* action: 'both',
|
|
@@ -31,6 +30,5 @@ import type { SanitizerConfig } from '@heliosjs/core/types';
|
|
|
31
30
|
* stripUnknown: true,
|
|
32
31
|
* })
|
|
33
32
|
* class ProfileController {}
|
|
34
|
-
* ```
|
|
35
33
|
*/
|
|
36
34
|
export declare function Sanitize(config: SanitizerConfig | SanitizerConfig[]): (target: any, propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
package/dist/sanitize.js
CHANGED
|
@@ -26,7 +26,6 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
26
26
|
* @returns A class or method decorator.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
|
-
* ```ts
|
|
30
29
|
* @Sanitize({
|
|
31
30
|
* type: 'body',
|
|
32
31
|
* action: 'both',
|
|
@@ -34,7 +33,6 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
34
33
|
* stripUnknown: true,
|
|
35
34
|
* })
|
|
36
35
|
* class ProfileController {}
|
|
37
|
-
* ```
|
|
38
36
|
*/
|
|
39
37
|
function Sanitize(config) {
|
|
40
38
|
return function (target, propertyKey, _descriptor) {
|
package/dist/sanitize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":";;AAkCA,4BAWC;AA5CD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,QAAQ,CAAC,MAA2C;IAClE,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,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,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;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/status.d.ts
CHANGED
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* @returns A class or method decorator.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* ```ts
|
|
17
16
|
* class UserController {
|
|
18
17
|
* @Post('/')
|
|
19
18
|
* @Status(201)
|
|
20
19
|
* create(@Body() dto: CreateUserDto) {}
|
|
21
20
|
* }
|
|
22
|
-
* ```
|
|
23
21
|
*/
|
|
24
22
|
export declare function Status(status: number): (target: any, propertyKey?: string) => void;
|
|
25
23
|
/**
|
package/dist/status.js
CHANGED
|
@@ -18,13 +18,11 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
18
18
|
* @returns A class or method decorator.
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
|
-
* ```ts
|
|
22
21
|
* class UserController {
|
|
23
22
|
* @Post('/')
|
|
24
23
|
* @Status(201)
|
|
25
24
|
* create(@Body() dto: CreateUserDto) {}
|
|
26
25
|
* }
|
|
27
|
-
* ```
|
|
28
26
|
*/
|
|
29
27
|
function Status(status) {
|
|
30
28
|
return function (target, propertyKey) {
|
package/dist/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":";;;AAsBA,wBAQC;AA9BD,gDAA6D;AAC7D;;;;;;;;;;;;;;;;;;;;GAoBG;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;aAAM,CAAC;YACN,IAAA,6BAAqB,EAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAC9C,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.d.ts
CHANGED
|
@@ -16,12 +16,10 @@ import type { MiddlewareCB } from '@heliosjs/core/types';
|
|
|
16
16
|
* @returns A class or method decorator.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
* ```ts
|
|
20
19
|
* @Use([authMiddleware, loggingMiddleware])
|
|
21
20
|
* class MyController {
|
|
22
21
|
* @Use(rateLimitMiddleware)
|
|
23
22
|
* getData() {}
|
|
24
23
|
* }
|
|
25
|
-
* ```
|
|
26
24
|
*/
|
|
27
|
-
export declare function Use(middleware: MiddlewareCB | MiddlewareCB[]): (target: any, propertyKey?: string,
|
|
25
|
+
export declare function Use(middleware: MiddlewareCB | MiddlewareCB[]): (target: any, propertyKey?: string, _descriptor?: PropertyDescriptor) => any;
|
package/dist/use.js
CHANGED
|
@@ -19,16 +19,14 @@ const utils_1 = require("@heliosjs/core/utils");
|
|
|
19
19
|
* @returns A class or method decorator.
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
|
-
* ```ts
|
|
23
22
|
* @Use([authMiddleware, loggingMiddleware])
|
|
24
23
|
* class MyController {
|
|
25
24
|
* @Use(rateLimitMiddleware)
|
|
26
25
|
* getData() {}
|
|
27
26
|
* }
|
|
28
|
-
* ```
|
|
29
27
|
*/
|
|
30
28
|
function Use(middleware) {
|
|
31
|
-
return function (target, propertyKey,
|
|
29
|
+
return function (target, propertyKey, _descriptor) {
|
|
32
30
|
const middlewares = Array.isArray(middleware) ? middleware : [middleware];
|
|
33
31
|
const data = middlewares.map((middleware) => ({ middleware }));
|
|
34
32
|
if (propertyKey) {
|
package/dist/use.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.js","sourceRoot":"","sources":["../src/use.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../src/use.ts"],"names":[],"mappings":";;AA0BA,kBAcC;AAvCD,gDAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,GAAG,CAAC,UAAyC;IAC3D,OAAO,UAAU,MAAW,EAAE,WAAoB,EAAE,WAAgC;QAClF,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,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAE/D,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": "10.0.
|
|
3
|
+
"version": "10.0.8",
|
|
4
4
|
"description": "Middlewares for @heliosjs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"reflect-metadata": "^0.2.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@heliosjs/core": "^3.2.
|
|
33
|
+
"@heliosjs/core": "^3.2.11",
|
|
34
34
|
"@types/node": ">=20.0.0",
|
|
35
35
|
"reflect-metadata": "^0.2.2",
|
|
36
36
|
"typescript": ">=5.0.0"
|