@nest-boot/middleware 7.2.1 → 7.2.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.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +18 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/middleware-config.interface.d.ts +18 -0
- package/dist/interfaces/middleware-config.interface.js.map +1 -0
- package/dist/middleware.configurator.d.ts +36 -1
- package/dist/middleware.configurator.js +42 -3
- package/dist/middleware.configurator.js.map +1 -1
- package/dist/middleware.manager.d.ts +28 -4
- package/dist/middleware.manager.js +24 -0
- package/dist/middleware.manager.js.map +1 -1
- package/dist/middleware.module.d.ts +8 -0
- package/dist/middleware.module.js +8 -0
- package/dist/middleware.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/middleware-function.type.d.ts +4 -0
- package/dist/types/middleware-function.type.js +3 -0
- package/dist/types/middleware-function.type.js.map +1 -0
- package/dist/types/middleware-instance-or-function.type.d.ts +6 -0
- package/dist/types/middleware-instance-or-function.type.js +3 -0
- package/dist/types/middleware-instance-or-function.type.js.map +1 -0
- package/package.json +19 -10
- package/dist/middleware-config.interface.d.ts +0 -8
- package/dist/middleware-config.interface.js.map +0 -1
- /package/dist/{middleware-config.interface.js → interfaces/middleware-config.interface.js} +0 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces"), exports);
|
|
17
18
|
__exportStar(require("./middleware.configurator"), exports);
|
|
18
19
|
__exportStar(require("./middleware.manager"), exports);
|
|
19
20
|
__exportStar(require("./middleware.module"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,uDAAqC;AACrC,sDAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,4DAA0C;AAC1C,uDAAqC;AACrC,sDAAoC;AACpC,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./middleware-config.interface";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./middleware-config.interface"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NestMiddleware, RouteInfo, Type } from "@nestjs/common/interfaces";
|
|
2
|
+
import { MiddlewareFunction } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a middleware.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface MiddlewareConfig {
|
|
8
|
+
/** The middleware function to execute */
|
|
9
|
+
middleware: MiddlewareFunction;
|
|
10
|
+
/** Routes to apply the middleware to */
|
|
11
|
+
routes: (string | Type | RouteInfo)[];
|
|
12
|
+
/** Routes to exclude from the middleware */
|
|
13
|
+
excludeRoutes: (string | RouteInfo)[];
|
|
14
|
+
/** Middlewares that must be applied before this one */
|
|
15
|
+
dependencyMiddlewares: Type<NestMiddleware>[];
|
|
16
|
+
/** Whether to disable global exclude routes for this middleware */
|
|
17
|
+
disabledGlobalExcludeRoutes: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-config.interface.js","sourceRoot":"","sources":["../../src/interfaces/middleware-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +1,50 @@
|
|
|
1
1
|
import { Type } from "@nestjs/common";
|
|
2
2
|
import { NestMiddleware, RouteInfo } from "@nestjs/common/interfaces";
|
|
3
3
|
import { MiddlewareManager } from "./middleware.manager";
|
|
4
|
+
import { MiddlewareInstanceOrFunction } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Fluent configurator for applying middlewares to routes.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Provides a chainable API for specifying route patterns, exclusions,
|
|
10
|
+
* and dependency ordering when registering middleware.
|
|
11
|
+
*/
|
|
4
12
|
export declare class MiddlewareConfigurator {
|
|
5
13
|
private readonly manager;
|
|
6
14
|
private readonly middlewares;
|
|
15
|
+
/** Whether global route exclusions are disabled for these middlewares. @internal */
|
|
7
16
|
private disabledGlobalExcludeRoutes;
|
|
17
|
+
/** Routes excluded from middleware processing. @internal */
|
|
8
18
|
private readonly excludeRoutes;
|
|
19
|
+
/** Middleware types that must run before this middleware. @internal */
|
|
9
20
|
private readonly dependencyMiddlewares;
|
|
10
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new MiddlewareConfigurator instance.
|
|
23
|
+
* @param manager - The middleware manager that owns this configurator
|
|
24
|
+
* @param middlewares - The middleware instances or functions to configure
|
|
25
|
+
*/
|
|
26
|
+
constructor(manager: MiddlewareManager, middlewares: MiddlewareInstanceOrFunction[]);
|
|
27
|
+
/**
|
|
28
|
+
* Disables global route exclusions for these middlewares.
|
|
29
|
+
* @returns This configurator for chaining
|
|
30
|
+
*/
|
|
11
31
|
disableGlobalExcludeRoutes(): this;
|
|
32
|
+
/**
|
|
33
|
+
* Excludes specific routes from middleware processing.
|
|
34
|
+
* @param routes - Route patterns or RouteInfo objects to exclude
|
|
35
|
+
* @returns This configurator for chaining
|
|
36
|
+
*/
|
|
12
37
|
exclude(...routes: (string | RouteInfo)[]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Declares middleware dependencies for ordering.
|
|
40
|
+
* @param dependencyMiddlewares - Middleware types that must run before this middleware
|
|
41
|
+
* @returns This configurator for chaining
|
|
42
|
+
*/
|
|
13
43
|
dependencies(...dependencyMiddlewares: Type<NestMiddleware>[]): this;
|
|
44
|
+
/**
|
|
45
|
+
* Applies the configured middlewares to the specified routes.
|
|
46
|
+
* @param routes - Route patterns, controller types, or RouteInfo objects
|
|
47
|
+
* @returns The parent {@link MiddlewareManager} for further configuration
|
|
48
|
+
*/
|
|
14
49
|
forRoutes(...routes: (string | Type | RouteInfo)[]): MiddlewareManager;
|
|
15
50
|
}
|
|
@@ -1,35 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MiddlewareConfigurator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Fluent configurator for applying middlewares to routes.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Provides a chainable API for specifying route patterns, exclusions,
|
|
9
|
+
* and dependency ordering when registering middleware.
|
|
10
|
+
*/
|
|
4
11
|
class MiddlewareConfigurator {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new MiddlewareConfigurator instance.
|
|
14
|
+
* @param manager - The middleware manager that owns this configurator
|
|
15
|
+
* @param middlewares - The middleware instances or functions to configure
|
|
16
|
+
*/
|
|
5
17
|
constructor(manager, middlewares) {
|
|
6
18
|
this.manager = manager;
|
|
7
19
|
this.middlewares = middlewares;
|
|
20
|
+
/** Whether global route exclusions are disabled for these middlewares. @internal */
|
|
8
21
|
this.disabledGlobalExcludeRoutes = false;
|
|
22
|
+
/** Routes excluded from middleware processing. @internal */
|
|
9
23
|
this.excludeRoutes = [];
|
|
24
|
+
/** Middleware types that must run before this middleware. @internal */
|
|
10
25
|
this.dependencyMiddlewares = [];
|
|
11
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Disables global route exclusions for these middlewares.
|
|
29
|
+
* @returns This configurator for chaining
|
|
30
|
+
*/
|
|
12
31
|
disableGlobalExcludeRoutes() {
|
|
13
32
|
this.disabledGlobalExcludeRoutes = true;
|
|
14
33
|
return this;
|
|
15
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Excludes specific routes from middleware processing.
|
|
37
|
+
* @param routes - Route patterns or RouteInfo objects to exclude
|
|
38
|
+
* @returns This configurator for chaining
|
|
39
|
+
*/
|
|
16
40
|
exclude(...routes) {
|
|
17
41
|
this.excludeRoutes.push(...routes);
|
|
18
42
|
return this;
|
|
19
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Declares middleware dependencies for ordering.
|
|
46
|
+
* @param dependencyMiddlewares - Middleware types that must run before this middleware
|
|
47
|
+
* @returns This configurator for chaining
|
|
48
|
+
*/
|
|
20
49
|
dependencies(...dependencyMiddlewares) {
|
|
21
50
|
this.dependencyMiddlewares.push(...dependencyMiddlewares);
|
|
22
51
|
return this;
|
|
23
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Applies the configured middlewares to the specified routes.
|
|
55
|
+
* @param routes - Route patterns, controller types, or RouteInfo objects
|
|
56
|
+
* @returns The parent {@link MiddlewareManager} for further configuration
|
|
57
|
+
*/
|
|
24
58
|
forRoutes(...routes) {
|
|
25
59
|
if (routes.length === 0) {
|
|
26
60
|
return this.manager;
|
|
27
61
|
}
|
|
28
62
|
this.middlewares.forEach((middleware) => {
|
|
29
63
|
this.manager.middlewareConfigMap.set(middleware, {
|
|
30
|
-
middleware: (req, res, next) =>
|
|
31
|
-
|
|
32
|
-
|
|
64
|
+
middleware: (req, res, next) => {
|
|
65
|
+
if ("use" in middleware) {
|
|
66
|
+
middleware.use(req, res, next);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
middleware(req, res, next);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
33
72
|
routes,
|
|
34
73
|
excludeRoutes: this.excludeRoutes,
|
|
35
74
|
dependencyMiddlewares: this.dependencyMiddlewares,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.configurator.js","sourceRoot":"","sources":["../src/middleware.configurator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"middleware.configurator.js","sourceRoot":"","sources":["../src/middleware.configurator.ts"],"names":[],"mappings":";;;AAMA;;;;;;GAMG;AACH,MAAa,sBAAsB;IAUjC;;;;OAIG;IACH,YACmB,OAA0B,EAC1B,WAA2C;QAD3C,YAAO,GAAP,OAAO,CAAmB;QAC1B,gBAAW,GAAX,WAAW,CAAgC;QAhB9D,oFAAoF;QAC5E,gCAA2B,GAAG,KAAK,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AA2B;aAC9D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AA/ED,wDA+EC"}
|
|
@@ -1,12 +1,36 @@
|
|
|
1
|
-
import { NestMiddleware } from "@nestjs/common";
|
|
2
1
|
import { MiddlewareConsumer, RouteInfo } from "@nestjs/common/interfaces";
|
|
2
|
+
import { MiddlewareConfig } from "./interfaces";
|
|
3
3
|
import { MiddlewareConfigurator } from "./middleware.configurator";
|
|
4
|
-
import {
|
|
4
|
+
import { MiddlewareInstanceOrFunction } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Service that manages middleware registration and topological ordering.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Provides an API similar to NestJS `MiddlewareConsumer` but adds support
|
|
10
|
+
* for dependency-based ordering and global route exclusions.
|
|
11
|
+
*/
|
|
5
12
|
export declare class MiddlewareManager {
|
|
13
|
+
/** Global routes excluded from all middleware processing. @internal */
|
|
6
14
|
private globalExcludeRoutes;
|
|
7
|
-
|
|
15
|
+
/** Map of middleware instances to their configurations. @internal */
|
|
16
|
+
readonly middlewareConfigMap: Map<MiddlewareInstanceOrFunction, MiddlewareConfig>;
|
|
17
|
+
/** Returns middleware configs sorted by dependency order. @internal */
|
|
8
18
|
private get middlewareConfigs();
|
|
9
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Creates a middleware configurator for the given middlewares.
|
|
21
|
+
* @param middlewares - Middleware instances or functions to apply
|
|
22
|
+
* @returns A {@link MiddlewareConfigurator} for specifying routes and options
|
|
23
|
+
*/
|
|
24
|
+
apply(...middlewares: MiddlewareInstanceOrFunction[]): MiddlewareConfigurator;
|
|
25
|
+
/**
|
|
26
|
+
* Adds routes to the global exclusion list (applies to all middlewares).
|
|
27
|
+
* @param routes - Route patterns or RouteInfo objects to exclude globally
|
|
28
|
+
* @returns This manager for chaining
|
|
29
|
+
*/
|
|
10
30
|
globalExclude(...routes: (string | RouteInfo)[]): this;
|
|
31
|
+
/**
|
|
32
|
+
* Applies all registered middleware configurations to the NestJS middleware consumer.
|
|
33
|
+
* @param consumer - The NestJS middleware consumer from the module's configure method
|
|
34
|
+
*/
|
|
11
35
|
configure(consumer: MiddlewareConsumer): void;
|
|
12
36
|
}
|
|
@@ -9,11 +9,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.MiddlewareManager = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const middleware_configurator_1 = require("./middleware.configurator");
|
|
12
|
+
/**
|
|
13
|
+
* Service that manages middleware registration and topological ordering.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Provides an API similar to NestJS `MiddlewareConsumer` but adds support
|
|
17
|
+
* for dependency-based ordering and global route exclusions.
|
|
18
|
+
*/
|
|
12
19
|
let MiddlewareManager = class MiddlewareManager {
|
|
13
20
|
constructor() {
|
|
21
|
+
/** Global routes excluded from all middleware processing. @internal */
|
|
14
22
|
this.globalExcludeRoutes = [];
|
|
23
|
+
/** Map of middleware instances to their configurations. @internal */
|
|
15
24
|
this.middlewareConfigMap = new Map();
|
|
16
25
|
}
|
|
26
|
+
/** Returns middleware configs sorted by dependency order. @internal */
|
|
17
27
|
get middlewareConfigs() {
|
|
18
28
|
const sorted = [];
|
|
19
29
|
const visited = new Set();
|
|
@@ -53,13 +63,27 @@ let MiddlewareManager = class MiddlewareManager {
|
|
|
53
63
|
.map((m) => this.middlewareConfigMap.get(m))
|
|
54
64
|
.filter((config) => config !== undefined);
|
|
55
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates a middleware configurator for the given middlewares.
|
|
68
|
+
* @param middlewares - Middleware instances or functions to apply
|
|
69
|
+
* @returns A {@link MiddlewareConfigurator} for specifying routes and options
|
|
70
|
+
*/
|
|
56
71
|
apply(...middlewares) {
|
|
57
72
|
return new middleware_configurator_1.MiddlewareConfigurator(this, middlewares);
|
|
58
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Adds routes to the global exclusion list (applies to all middlewares).
|
|
76
|
+
* @param routes - Route patterns or RouteInfo objects to exclude globally
|
|
77
|
+
* @returns This manager for chaining
|
|
78
|
+
*/
|
|
59
79
|
globalExclude(...routes) {
|
|
60
80
|
this.globalExcludeRoutes.push(...routes);
|
|
61
81
|
return this;
|
|
62
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Applies all registered middleware configurations to the NestJS middleware consumer.
|
|
85
|
+
* @param consumer - The NestJS middleware consumer from the module's configure method
|
|
86
|
+
*/
|
|
63
87
|
configure(consumer) {
|
|
64
88
|
for (const config of this.middlewareConfigs) {
|
|
65
89
|
const proxy = consumer.apply(config.middleware);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.manager.js","sourceRoot":"","sources":["../src/middleware.manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAkE;
|
|
1
|
+
{"version":3,"file":"middleware.manager.js","sourceRoot":"","sources":["../src/middleware.manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAkE;AAIlE,uEAAmE;AAGnE;;;;;;GAMG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QACL,uEAAuE;QAC/D,wBAAmB,GAA2B,EAAE,CAAC;QAEzD,qEAAqE;QACrD,wBAAmB,GAAG,IAAI,GAAG,EAG1C,CAAC;IAgGN,CAAC;IA9FC,uEAAuE;IACvE,IAAY,iBAAiB;QAC3B,MAAM,MAAM,GAAmC,EAAE,CAAC;QAClD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAgC,CAAC;QACxD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;QAEzD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAwC,CAAC;QACzE,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC;YACzD,IAAI,OAAO,UAAU,KAAK,QAAQ,I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|
|
4
|
+
* Global module that provides the {@link MiddlewareManager} for registering
|
|
5
|
+
* and configuring middleware with dependency ordering support.
|
|
6
|
+
*/
|
|
3
7
|
export declare class MiddlewareModule implements NestModule {
|
|
4
8
|
private readonly middlewareManager;
|
|
9
|
+
/** Creates a new MiddlewareModule instance.
|
|
10
|
+
* @param middlewareManager - The middleware manager instance
|
|
11
|
+
*/
|
|
5
12
|
constructor(middlewareManager: MiddlewareManager);
|
|
13
|
+
/** Configures all registered middlewares through the NestJS middleware consumer. */
|
|
6
14
|
configure(consumer: MiddlewareConsumer): void;
|
|
7
15
|
}
|
|
@@ -12,10 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MiddlewareModule = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const middleware_manager_1 = require("./middleware.manager");
|
|
15
|
+
/**
|
|
16
|
+
* Global module that provides the {@link MiddlewareManager} for registering
|
|
17
|
+
* and configuring middleware with dependency ordering support.
|
|
18
|
+
*/
|
|
15
19
|
let MiddlewareModule = class MiddlewareModule {
|
|
20
|
+
/** Creates a new MiddlewareModule instance.
|
|
21
|
+
* @param middlewareManager - The middleware manager instance
|
|
22
|
+
*/
|
|
16
23
|
constructor(middlewareManager) {
|
|
17
24
|
this.middlewareManager = middlewareManager;
|
|
18
25
|
}
|
|
26
|
+
/** Configures all registered middlewares through the NestJS middleware consumer. */
|
|
19
27
|
configure(consumer) {
|
|
20
28
|
this.middlewareManager.configure(consumer);
|
|
21
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.module.js","sourceRoot":"","sources":["../src/middleware.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgF;AAEhF,6DAAyD;
|
|
1
|
+
{"version":3,"file":"middleware.module.js","sourceRoot":"","sources":["../src/middleware.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgF;AAEhF,6DAAyD;AAEzD;;;GAGG;AAMI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B;;OAEG;IACH,YAA6B,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAG,CAAC;IAErE,oFAAoF;IACpF,SAAS,CAAC,QAA4B;QACpC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;CACF,CAAA;AAVY,4CAAgB;2BAAhB,gBAAgB;IAL5B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,sCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,sCAAiB,CAAC;KAC7B,CAAC;qCAKgD,sCAAiB;GAJtD,gBAAgB,CAU5B"}
|