@tsed/platform-middlewares 7.0.0-beta.2 → 7.0.0-beta.20

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/jest.config.js ADDED
@@ -0,0 +1,14 @@
1
+ // For a detailed explanation regarding each configuration property, visit:
2
+ // https://jestjs.io/docs/en/configuration.html
3
+
4
+ module.exports = {
5
+ ...require("@tsed/jest-config")(__dirname, "platform-middlewares"),
6
+ coverageThreshold: {
7
+ global: {
8
+ statements: 100,
9
+ branches: 100,
10
+ functions: 100,
11
+ lines: 100
12
+ }
13
+ }
14
+ };
@@ -31,4 +31,4 @@ exports.HTTP_METHODS = [
31
31
  "unlock",
32
32
  "unsuscribe"
33
33
  ];
34
- //# sourceMappingURL=index.js.map
34
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,YAAY;CACb,CAAC","sourcesContent":["export const HTTP_METHODS = [\n \"all\",\n \"checkout\",\n \"connect\",\n \"copy\",\n \"delete\",\n \"get\",\n \"head\",\n \"lock\",\n \"merge\",\n \"mkactivity\",\n \"mkcol\",\n \"move\",\n \"m-search\",\n \"notify\",\n \"options\",\n \"param\",\n \"patch\",\n \"post\",\n \"propfind\",\n \"propatch\",\n \"purge\",\n \"put\",\n \"report\",\n \"search\",\n \"subscribe\",\n \"trace\",\n \"unlock\",\n \"unsuscribe\"\n];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/decorators/use.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yCAAkF;AAGlF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,GAAG,CAAC,GAAG,IAAW;IAChC,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,cAAK,EAAC,GAAG,IAAI,CAAC,CAAC;YAExB,KAAK,qBAAc,CAAC,KAAK;gBACvB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE;oBAChC,GAAG,EAAE,IAAI;iBACV,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;SACvD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAhBD,kBAgBC","sourcesContent":["import {DecoratorTypes, UnsupportedDecoratorType} from \"@tsed/core\";\nimport {JsonEntityFn, OperationMethods, OperationPath, Route} from \"@tsed/schema\";\nimport {mapUseOptions} from \"../utils/mapUseOptions\";\n\n/**\n * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when\n * the base of the requested path matches `path.\n *\n * ```typescript\n * @Controller('/')\n * @Use(Middleware1)\n * export class Ctrl {\n *\n * @Get('/')\n * @Use(Middleware2)\n * get() { }\n * }\n *\n * ```\n *\n * @returns {Function}\n * @param args\n * @decorator\n * @operation\n */\nexport function Use(...args: any[]): Function {\n return JsonEntityFn((entity, parameters) => {\n switch (entity.decoratorType) {\n case DecoratorTypes.METHOD:\n return Route(...args);\n\n case DecoratorTypes.CLASS:\n entity.store.merge(\"middlewares\", {\n use: args\n });\n break;\n\n default:\n throw new UnsupportedDecoratorType(Use, parameters);\n }\n });\n}\n"]}
1
+ {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/decorators/use.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yCAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,GAAG,CAAC,GAAG,IAAW;IAChC,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,cAAK,EAAC,GAAG,IAAI,CAAC,CAAC;YAExB,KAAK,qBAAc,CAAC,KAAK;gBACvB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE;oBAChC,GAAG,EAAE,IAAI;iBACV,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;SACvD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAhBD,kBAgBC","sourcesContent":["import {DecoratorTypes, UnsupportedDecoratorType} from \"@tsed/core\";\nimport {JsonEntityFn, Route} from \"@tsed/schema\";\n\n/**\n * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when\n * the base of the requested path matches `path.\n *\n * ```typescript\n * @Controller('/')\n * @Use(Middleware1)\n * export class Ctrl {\n *\n * @Get('/')\n * @Use(Middleware2)\n * get() { }\n * }\n *\n * ```\n *\n * @returns {Function}\n * @param args\n * @decorator\n * @operation\n */\nexport function Use(...args: any[]): Function {\n return JsonEntityFn((entity, parameters) => {\n switch (entity.decoratorType) {\n case DecoratorTypes.METHOD:\n return Route(...args);\n\n case DecoratorTypes.CLASS:\n entity.store.merge(\"middlewares\", {\n use: args\n });\n break;\n\n default:\n throw new UnsupportedDecoratorType(Use, parameters);\n }\n });\n}\n"]}
package/lib/cjs/index.js CHANGED
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tslib_1 = require("tslib");
4
- // decorators
5
- (0, tslib_1.__exportStar)(require("./decorators/middleware"), exports);
6
- (0, tslib_1.__exportStar)(require("./decorators/authOptions"), exports);
7
- (0, tslib_1.__exportStar)(require("./decorators/use"), exports);
8
- (0, tslib_1.__exportStar)(require("./decorators/useAfter"), exports);
9
- (0, tslib_1.__exportStar)(require("./decorators/useAuth"), exports);
10
- (0, tslib_1.__exportStar)(require("./decorators/useBefore"), exports);
11
- (0, tslib_1.__exportStar)(require("./decorators/useBeforeEach"), exports);
12
- // domain
13
- (0, tslib_1.__exportStar)(require("./domain/MiddlewareMethods"), exports);
14
- (0, tslib_1.__exportStar)(require("./domain/PlatformMiddlewareSettings"), exports);
15
- // utils
16
- (0, tslib_1.__exportStar)(require("./utils/getMiddlewaresForHook"), exports);
7
+ tslib_1.__exportStar(require("./constants/constants"), exports);
8
+ tslib_1.__exportStar(require("./decorators/authOptions"), exports);
9
+ tslib_1.__exportStar(require("./decorators/middleware"), exports);
10
+ tslib_1.__exportStar(require("./decorators/use"), exports);
11
+ tslib_1.__exportStar(require("./decorators/useAfter"), exports);
12
+ tslib_1.__exportStar(require("./decorators/useAuth"), exports);
13
+ tslib_1.__exportStar(require("./decorators/useBefore"), exports);
14
+ tslib_1.__exportStar(require("./decorators/useBeforeEach"), exports);
15
+ tslib_1.__exportStar(require("./domain/MiddlewareMethods"), exports);
16
+ tslib_1.__exportStar(require("./domain/PlatformMiddlewareSettings"), exports);
17
+ tslib_1.__exportStar(require("./utils/getMiddlewaresForHook"), exports);
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uEAAwC;AACxC,wEAAyC;AACzC,gEAAiC;AACjC,qEAAsC;AACtC,oEAAqC;AACrC,sEAAuC;AACvC,0EAA2C;AAE3C,SAAS;AACT,0EAA2C;AAC3C,mFAAoD;AAEpD,QAAQ;AACR,6EAA8C","sourcesContent":["// decorators\nexport * from \"./decorators/middleware\";\nexport * from \"./decorators/authOptions\";\nexport * from \"./decorators/use\";\nexport * from \"./decorators/useAfter\";\nexport * from \"./decorators/useAuth\";\nexport * from \"./decorators/useBefore\";\nexport * from \"./decorators/useBeforeEach\";\n\n// domain\nexport * from \"./domain/MiddlewareMethods\";\nexport * from \"./domain/PlatformMiddlewareSettings\";\n\n// utils\nexport * from \"./utils/getMiddlewaresForHook\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gEAAsC;AACtC,mEAAyC;AACzC,kEAAwC;AACxC,2DAAiC;AACjC,gEAAsC;AACtC,+DAAqC;AACrC,iEAAuC;AACvC,qEAA2C;AAC3C,qEAA2C;AAC3C,8EAAoD;AACpD,wEAA8C","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./constants/constants\";\nexport * from \"./decorators/authOptions\";\nexport * from \"./decorators/middleware\";\nexport * from \"./decorators/use\";\nexport * from \"./decorators/useAfter\";\nexport * from \"./decorators/useAuth\";\nexport * from \"./decorators/useBefore\";\nexport * from \"./decorators/useBeforeEach\";\nexport * from \"./domain/MiddlewareMethods\";\nexport * from \"./domain/PlatformMiddlewareSettings\";\nexport * from \"./utils/getMiddlewaresForHook\";\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMiddlewaresForHook = void 0;
4
4
  const core_1 = require("@tsed/core");
5
5
  function getMiddlewaresForHook(hook, settings, defaultHook = "") {
6
- const { env, middlewares = [] } = settings;
6
+ const env = settings.env;
7
+ const middlewares = settings.get("middlewares", []);
7
8
  return middlewares
8
9
  .map((middleware) => {
9
10
  return (0, core_1.isFunction)(middleware)
@@ -18,9 +19,7 @@ function getMiddlewaresForHook(hook, settings, defaultHook = "") {
18
19
  ...middleware
19
20
  };
20
21
  })
21
- .filter((options) => {
22
- return options.use && options.env === env && options.hook === hook;
23
- });
22
+ .filter((options) => options.use && options.env === env && options.hook === hook);
24
23
  }
25
24
  exports.getMiddlewaresForHook = getMiddlewaresForHook;
26
25
  //# sourceMappingURL=getMiddlewaresForHook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAGtC,SAAgB,qBAAqB,CAAC,IAAY,EAAE,QAA4B,EAAE,WAAW,GAAG,EAAE;IAChG,MAAM,EAAC,GAAG,EAAE,WAAW,GAAG,EAAE,EAAC,GAAG,QAAQ,CAAC;IAEzC,OAAO,WAAW;SACf,GAAG,CAAmC,CAAC,UAAU,EAAE,EAAE;QACpD,OAAO,IAAA,iBAAU,EAAC,UAAU,CAAC;YAC3B,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,EAAE,UAAU;aAChB;YACH,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,UAAU;aACd,CAAC;IACR,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC;AApBD,sDAoBC","sourcesContent":["import {isFunction} from \"@tsed/core\";\nimport {PlatformMiddlewareLoadingOptions} from \"../domain/PlatformMiddlewareSettings\";\n\nexport function getMiddlewaresForHook(hook: string, settings: TsED.Configuration, defaultHook = \"\") {\n const {env, middlewares = []} = settings;\n\n return middlewares\n .map<PlatformMiddlewareLoadingOptions>((middleware) => {\n return isFunction(middleware)\n ? {\n env,\n hook: defaultHook,\n use: middleware\n }\n : {\n env,\n hook: defaultHook,\n ...middleware\n };\n })\n .filter((options) => {\n return options.use && options.env === env && options.hook === hook;\n });\n}\n"]}
1
+ {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAItC,SAAgB,qBAAqB,CAAC,IAAY,EAAE,QAAyB,EAAE,WAAW,GAAG,EAAE;IAC7F,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IACzB,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAA+B,aAAa,EAAE,EAAE,CAAC,CAAC;IAElF,OAAO,WAAW;SACf,GAAG,CAAmC,CAAC,UAAU,EAAE,EAAE;QACpD,OAAO,IAAA,iBAAU,EAAC,UAAU,CAAC;YAC3B,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,EAAE,UAAU;aAChB;YACH,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,UAAU;aACd,CAAC;IACR,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtF,CAAC;AAnBD,sDAmBC","sourcesContent":["import {isFunction} from \"@tsed/core\";\nimport {DIConfiguration} from \"@tsed/di\";\nimport {PlatformMiddlewareLoadingOptions, PlatformMiddlewareSettings} from \"../domain/PlatformMiddlewareSettings\";\n\nexport function getMiddlewaresForHook(hook: string, settings: DIConfiguration, defaultHook = \"\") {\n const env = settings.env;\n const middlewares = settings.get<PlatformMiddlewareSettings[]>(\"middlewares\", []);\n\n return middlewares\n .map<PlatformMiddlewareLoadingOptions>((middleware) => {\n return isFunction(middleware)\n ? {\n env,\n hook: defaultHook,\n use: middleware\n }\n : {\n env,\n hook: defaultHook,\n ...middleware\n };\n })\n .filter((options) => options.use && options.env === env && options.hook === hook);\n}\n"]}
@@ -28,4 +28,4 @@ export const HTTP_METHODS = [
28
28
  "unlock",
29
29
  "unsuscribe"
30
30
  ];
31
- //# sourceMappingURL=index.js.map
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,YAAY;CACb,CAAC","sourcesContent":["export const HTTP_METHODS = [\n \"all\",\n \"checkout\",\n \"connect\",\n \"copy\",\n \"delete\",\n \"get\",\n \"head\",\n \"lock\",\n \"merge\",\n \"mkactivity\",\n \"mkcol\",\n \"move\",\n \"m-search\",\n \"notify\",\n \"options\",\n \"param\",\n \"patch\",\n \"post\",\n \"propfind\",\n \"propatch\",\n \"purge\",\n \"put\",\n \"report\",\n \"search\",\n \"subscribe\",\n \"trace\",\n \"unlock\",\n \"unsuscribe\"\n];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/decorators/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,YAAY,EAAmC,KAAK,EAAC,MAAM,cAAc,CAAC;AAGlF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,GAAG,CAAC,GAAG,IAAW;IAChC,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,cAAc,CAAC,MAAM;gBACxB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAExB,KAAK,cAAc,CAAC,KAAK;gBACvB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE;oBAChC,GAAG,EAAE,IAAI;iBACV,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;SACvD;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {DecoratorTypes, UnsupportedDecoratorType} from \"@tsed/core\";\nimport {JsonEntityFn, OperationMethods, OperationPath, Route} from \"@tsed/schema\";\nimport {mapUseOptions} from \"../utils/mapUseOptions\";\n\n/**\n * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when\n * the base of the requested path matches `path.\n *\n * ```typescript\n * @Controller('/')\n * @Use(Middleware1)\n * export class Ctrl {\n *\n * @Get('/')\n * @Use(Middleware2)\n * get() { }\n * }\n *\n * ```\n *\n * @returns {Function}\n * @param args\n * @decorator\n * @operation\n */\nexport function Use(...args: any[]): Function {\n return JsonEntityFn((entity, parameters) => {\n switch (entity.decoratorType) {\n case DecoratorTypes.METHOD:\n return Route(...args);\n\n case DecoratorTypes.CLASS:\n entity.store.merge(\"middlewares\", {\n use: args\n });\n break;\n\n default:\n throw new UnsupportedDecoratorType(Use, parameters);\n }\n });\n}\n"]}
1
+ {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/decorators/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,GAAG,CAAC,GAAG,IAAW;IAChC,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,cAAc,CAAC,MAAM;gBACxB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAExB,KAAK,cAAc,CAAC,KAAK;gBACvB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE;oBAChC,GAAG,EAAE,IAAI;iBACV,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;SACvD;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {DecoratorTypes, UnsupportedDecoratorType} from \"@tsed/core\";\nimport {JsonEntityFn, Route} from \"@tsed/schema\";\n\n/**\n * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when\n * the base of the requested path matches `path.\n *\n * ```typescript\n * @Controller('/')\n * @Use(Middleware1)\n * export class Ctrl {\n *\n * @Get('/')\n * @Use(Middleware2)\n * get() { }\n * }\n *\n * ```\n *\n * @returns {Function}\n * @param args\n * @decorator\n * @operation\n */\nexport function Use(...args: any[]): Function {\n return JsonEntityFn((entity, parameters) => {\n switch (entity.decoratorType) {\n case DecoratorTypes.METHOD:\n return Route(...args);\n\n case DecoratorTypes.CLASS:\n entity.store.merge(\"middlewares\", {\n use: args\n });\n break;\n\n default:\n throw new UnsupportedDecoratorType(Use, parameters);\n }\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { decorateMethodsOf, decoratorTypeOf, DecoratorTypes, StoreFn, UnsupportedDecoratorType, useDecorators } from "@tsed/core";
2
- import { AuthOptions } from "./authOptions";
3
- import { UseBefore } from "./useBefore";
2
+ import { AuthOptions } from "./authOptions.js";
3
+ import { UseBefore } from "./useBefore.js";
4
4
  /**
5
5
  * Use custom authentication strategy on your endpoint.
6
6
  *
@@ -1,5 +1,5 @@
1
1
  import { decorateMethodsOf, decoratorTypeOf, DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { UseBefore } from "./useBefore";
2
+ import { UseBefore } from "./useBefore.js";
3
3
  /**
4
4
  * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
5
5
  * the base of the requested path matches `path.
package/lib/esm/index.js CHANGED
@@ -1,14 +1,15 @@
1
- // decorators
2
- export * from "./decorators/middleware";
3
- export * from "./decorators/authOptions";
4
- export * from "./decorators/use";
5
- export * from "./decorators/useAfter";
6
- export * from "./decorators/useAuth";
7
- export * from "./decorators/useBefore";
8
- export * from "./decorators/useBeforeEach";
9
- // domain
10
- export * from "./domain/MiddlewareMethods";
11
- export * from "./domain/PlatformMiddlewareSettings";
12
- // utils
13
- export * from "./utils/getMiddlewaresForHook";
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
4
+ export * from "./constants/constants.js";
5
+ export * from "./decorators/authOptions.js";
6
+ export * from "./decorators/middleware.js";
7
+ export * from "./decorators/use.js";
8
+ export * from "./decorators/useAfter.js";
9
+ export * from "./decorators/useAuth.js";
10
+ export * from "./decorators/useBefore.js";
11
+ export * from "./decorators/useBeforeEach.js";
12
+ export * from "./domain/MiddlewareMethods.js";
13
+ export * from "./domain/PlatformMiddlewareSettings.js";
14
+ export * from "./utils/getMiddlewaresForHook.js";
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAE3C,SAAS;AACT,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AAEpD,QAAQ;AACR,cAAc,+BAA+B,CAAC","sourcesContent":["// decorators\nexport * from \"./decorators/middleware\";\nexport * from \"./decorators/authOptions\";\nexport * from \"./decorators/use\";\nexport * from \"./decorators/useAfter\";\nexport * from \"./decorators/useAuth\";\nexport * from \"./decorators/useBefore\";\nexport * from \"./decorators/useBeforeEach\";\n\n// domain\nexport * from \"./domain/MiddlewareMethods\";\nexport * from \"./domain/PlatformMiddlewareSettings\";\n\n// utils\nexport * from \"./utils/getMiddlewaresForHook\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./constants/constants\";\nexport * from \"./decorators/authOptions\";\nexport * from \"./decorators/middleware\";\nexport * from \"./decorators/use\";\nexport * from \"./decorators/useAfter\";\nexport * from \"./decorators/useAuth\";\nexport * from \"./decorators/useBefore\";\nexport * from \"./decorators/useBeforeEach\";\nexport * from \"./domain/MiddlewareMethods\";\nexport * from \"./domain/PlatformMiddlewareSettings\";\nexport * from \"./utils/getMiddlewaresForHook\";\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -1,6 +1,7 @@
1
1
  import { isFunction } from "@tsed/core";
2
2
  export function getMiddlewaresForHook(hook, settings, defaultHook = "") {
3
- const { env, middlewares = [] } = settings;
3
+ const env = settings.env;
4
+ const middlewares = settings.get("middlewares", []);
4
5
  return middlewares
5
6
  .map((middleware) => {
6
7
  return isFunction(middleware)
@@ -15,8 +16,6 @@ export function getMiddlewaresForHook(hook, settings, defaultHook = "") {
15
16
  ...middleware
16
17
  };
17
18
  })
18
- .filter((options) => {
19
- return options.use && options.env === env && options.hook === hook;
20
- });
19
+ .filter((options) => options.use && options.env === env && options.hook === hook);
21
20
  }
22
21
  //# sourceMappingURL=getMiddlewaresForHook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAA4B,EAAE,WAAW,GAAG,EAAE;IAChG,MAAM,EAAC,GAAG,EAAE,WAAW,GAAG,EAAE,EAAC,GAAG,QAAQ,CAAC;IAEzC,OAAO,WAAW;SACf,GAAG,CAAmC,CAAC,UAAU,EAAE,EAAE;QACpD,OAAO,UAAU,CAAC,UAAU,CAAC;YAC3B,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,EAAE,UAAU;aAChB;YACH,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,UAAU;aACd,CAAC;IACR,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {isFunction} from \"@tsed/core\";\nimport {PlatformMiddlewareLoadingOptions} from \"../domain/PlatformMiddlewareSettings\";\n\nexport function getMiddlewaresForHook(hook: string, settings: TsED.Configuration, defaultHook = \"\") {\n const {env, middlewares = []} = settings;\n\n return middlewares\n .map<PlatformMiddlewareLoadingOptions>((middleware) => {\n return isFunction(middleware)\n ? {\n env,\n hook: defaultHook,\n use: middleware\n }\n : {\n env,\n hook: defaultHook,\n ...middleware\n };\n })\n .filter((options) => {\n return options.use && options.env === env && options.hook === hook;\n });\n}\n"]}
1
+ {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAItC,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAAyB,EAAE,WAAW,GAAG,EAAE;IAC7F,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IACzB,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAA+B,aAAa,EAAE,EAAE,CAAC,CAAC;IAElF,OAAO,WAAW;SACf,GAAG,CAAmC,CAAC,UAAU,EAAE,EAAE;QACpD,OAAO,UAAU,CAAC,UAAU,CAAC;YAC3B,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,EAAE,UAAU;aAChB;YACH,CAAC,CAAC;gBACE,GAAG;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,UAAU;aACd,CAAC;IACR,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import {isFunction} from \"@tsed/core\";\nimport {DIConfiguration} from \"@tsed/di\";\nimport {PlatformMiddlewareLoadingOptions, PlatformMiddlewareSettings} from \"../domain/PlatformMiddlewareSettings\";\n\nexport function getMiddlewaresForHook(hook: string, settings: DIConfiguration, defaultHook = \"\") {\n const env = settings.env;\n const middlewares = settings.get<PlatformMiddlewareSettings[]>(\"middlewares\", []);\n\n return middlewares\n .map<PlatformMiddlewareLoadingOptions>((middleware) => {\n return isFunction(middleware)\n ? {\n env,\n hook: defaultHook,\n use: middleware\n }\n : {\n env,\n hook: defaultHook,\n ...middleware\n };\n })\n .filter((options) => options.use && options.env === env && options.hook === hook);\n}\n"]}
@@ -1,5 +1,9 @@
1
- export * from "./decorators/middleware";
1
+ /**
2
+ * @file Automatically generated by barrelsby.
3
+ */
4
+ export * from "./constants/constants";
2
5
  export * from "./decorators/authOptions";
6
+ export * from "./decorators/middleware";
3
7
  export * from "./decorators/use";
4
8
  export * from "./decorators/useAfter";
5
9
  export * from "./decorators/useAuth";
@@ -1,2 +1,3 @@
1
+ import { DIConfiguration } from "@tsed/di";
1
2
  import { PlatformMiddlewareLoadingOptions } from "../domain/PlatformMiddlewareSettings";
2
- export declare function getMiddlewaresForHook(hook: string, settings: TsED.Configuration, defaultHook?: string): PlatformMiddlewareLoadingOptions[];
3
+ export declare function getMiddlewaresForHook(hook: string, settings: DIConfiguration, defaultHook?: string): PlatformMiddlewareLoadingOptions[];
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@tsed/platform-middlewares",
3
- "version": "7.0.0-beta.2",
3
+ "version": "7.0.0-beta.20",
4
4
  "description": "Middlewares module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/cjs/index.js",
8
+ "module": "./lib/esm/index.js",
8
9
  "typings": "./lib/types/index.d.ts",
9
10
  "exports": {
10
11
  "types": "./lib/types/index.d.ts",
@@ -13,28 +14,44 @@
13
14
  "default": "./lib/esm/index.js"
14
15
  },
15
16
  "scripts": {
16
- "build": "yarn run build:esm && yarn run build:cjs",
17
+ "build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
17
18
  "build:cjs": "tsc --build tsconfig.compile.json",
18
- "build:esm": "tsc --build tsconfig.compile.esm.json"
19
+ "build:esm": "tsc --build tsconfig.compile.esm.json",
20
+ "barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
21
+ "test": "cross-env NODE_ENV=test yarn jest --max-workers=2"
19
22
  },
20
23
  "dependencies": {
21
- "tslib": "2.2.0"
24
+ "tslib": "2.4.0"
22
25
  },
23
26
  "devDependencies": {
24
- "@tsed/core": "7.0.0-beta.2",
25
- "@tsed/di": "7.0.0-beta.2",
26
- "@tsed/schema": "7.0.0-beta.2"
27
+ "@tsed/core": "7.0.0-beta.20",
28
+ "@tsed/di": "7.0.0-beta.20",
29
+ "@tsed/schema": "7.0.0-beta.20"
27
30
  },
28
31
  "peerDependencies": {
29
- "@tsed/core": "^7.0.0-beta.2",
30
- "@tsed/di": "^7.0.0-beta.2",
31
- "@tsed/schema": "^7.0.0-beta.2"
32
+ "@tsed/core": "^7.0.0-beta.20",
33
+ "@tsed/di": "^7.0.0-beta.20",
34
+ "@tsed/schema": "^7.0.0-beta.20"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@tsed/core": {
38
+ "optional": true
39
+ },
40
+ "@tsed/di": {
41
+ "optional": true
42
+ },
43
+ "@tsed/schema": {
44
+ "optional": true
45
+ }
32
46
  },
33
47
  "repository": "https://github.com/tsedio/tsed",
34
48
  "bugs": {
35
49
  "url": "https://github.com/tsedio/tsed/issues"
36
50
  },
37
- "homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/platform/platform-middlewares",
51
+ "homepage": "https://github.com/tsedio/tsed/tree/beta/packages/platform/platform-middlewares",
38
52
  "author": "Romain Lenzotti",
39
- "license": "MIT"
53
+ "license": "MIT",
54
+ "publishConfig": {
55
+ "tag": "beta"
56
+ }
40
57
  }
package/readme.md CHANGED
@@ -11,7 +11,8 @@
11
11
  [![npm version](https://badge.fury.io/js/%40tsed%2Fcommon.svg)](https://badge.fury.io/js/%40tsed%2Fcommon)
12
12
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
13
13
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
14
- [![backers](https://opencollective.com/tsed/tiers/badge.svg)](https://opencollective.com/tsed)
14
+ [![github](https://img.shields.io/static/v1?label=Github%20sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/romakita)
15
+ [![opencollective](https://img.shields.io/static/v1?label=OpenCollective%20sponsor&message=%E2%9D%A4&logo=OpenCollective&color=%23fe8e86)](https://opencollective.com/tsed)
15
16
 
16
17
  </div>
17
18
 
@@ -36,18 +37,17 @@ npm install --save @tsed/platform-middlewares
36
37
  ```
37
38
 
38
39
  ## Contributors
40
+
39
41
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html).
40
42
 
41
43
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
42
44
 
43
-
44
45
  ## Backers
45
46
 
46
47
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
47
48
 
48
49
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
49
50
 
50
-
51
51
  ## Sponsors
52
52
 
53
53
  Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
@@ -56,7 +56,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
56
56
 
57
57
  The MIT License (MIT)
58
58
 
59
- Copyright (c) 2016 - 2018 Romain Lenzotti
59
+ Copyright (c) 2016 - 2022 Romain Lenzotti
60
60
 
61
61
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
62
62
 
@@ -8,16 +8,5 @@
8
8
  "declaration": true,
9
9
  "declarationDir": "./lib/types"
10
10
  },
11
- "exclude": [
12
- "node_modules",
13
- "test",
14
- "lib",
15
- "benchmark",
16
- "coverage",
17
- "spec",
18
- "**/*.benchmark.ts",
19
- "**/*.spec.ts",
20
- "keys",
21
- "jest.config.js"
22
- ]
11
+ "exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
23
12
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,YAAY;CACb,CAAC","sourcesContent":["export const HTTP_METHODS = [\n \"all\",\n \"checkout\",\n \"connect\",\n \"copy\",\n \"delete\",\n \"get\",\n \"head\",\n \"lock\",\n \"merge\",\n \"mkactivity\",\n \"mkcol\",\n \"move\",\n \"m-search\",\n \"notify\",\n \"options\",\n \"param\",\n \"patch\",\n \"post\",\n \"propfind\",\n \"propatch\",\n \"purge\",\n \"put\",\n \"report\",\n \"search\",\n \"subscribe\",\n \"trace\",\n \"unlock\",\n \"unsuscribe\"\n];\n"]}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapUseOptions = void 0;
4
- const constants_1 = require("../constants");
5
- function mapUseOptions(args) {
6
- let method = undefined;
7
- let path = undefined;
8
- const middlewares = args.filter((arg) => {
9
- if (typeof arg === "string" && constants_1.HTTP_METHODS.includes(arg)) {
10
- method = arg;
11
- return false;
12
- }
13
- if (typeof arg === "string" || arg instanceof RegExp) {
14
- path = arg ? arg : "/";
15
- return false;
16
- }
17
- return !!arg;
18
- });
19
- return {
20
- path,
21
- method,
22
- middlewares
23
- };
24
- }
25
- exports.mapUseOptions = mapUseOptions;
26
- //# sourceMappingURL=mapUseOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapUseOptions.js","sourceRoot":"","sources":["../../../src/utils/mapUseOptions.ts"],"names":[],"mappings":";;;AAAA,4CAA0C;AAE1C,SAAgB,aAAa,CAAC,IAAW;IACvC,IAAI,MAAM,GAAuB,SAAS,CAAC;IAC3C,IAAI,IAAI,GAAgC,SAAS,CAAC;IAElD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,EAAE;QAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,wBAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACzD,MAAM,GAAG,GAAG,CAAC;YAEb,OAAO,KAAK,CAAC;SACd;QAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,YAAY,MAAM,EAAE;YACpD,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YAEvB,OAAO,KAAK,CAAC;SACd;QAED,OAAO,CAAC,CAAC,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI;QACJ,MAAM;QACN,WAAW;KACZ,CAAC;AACJ,CAAC;AAzBD,sCAyBC","sourcesContent":["import {HTTP_METHODS} from \"../constants\";\n\nexport function mapUseOptions(args: any[]) {\n let method: string | undefined = undefined;\n let path: string | RegExp | undefined = undefined;\n\n const middlewares = args.filter((arg: any) => {\n if (typeof arg === \"string\" && HTTP_METHODS.includes(arg)) {\n method = arg;\n\n return false;\n }\n\n if (typeof arg === \"string\" || arg instanceof RegExp) {\n path = arg ? arg : \"/\";\n\n return false;\n }\n\n return !!arg;\n });\n\n return {\n path,\n method,\n middlewares\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,YAAY;CACb,CAAC","sourcesContent":["export const HTTP_METHODS = [\n \"all\",\n \"checkout\",\n \"connect\",\n \"copy\",\n \"delete\",\n \"get\",\n \"head\",\n \"lock\",\n \"merge\",\n \"mkactivity\",\n \"mkcol\",\n \"move\",\n \"m-search\",\n \"notify\",\n \"options\",\n \"param\",\n \"patch\",\n \"post\",\n \"propfind\",\n \"propatch\",\n \"purge\",\n \"put\",\n \"report\",\n \"search\",\n \"subscribe\",\n \"trace\",\n \"unlock\",\n \"unsuscribe\"\n];\n"]}
@@ -1,22 +0,0 @@
1
- import { HTTP_METHODS } from "../constants";
2
- export function mapUseOptions(args) {
3
- let method = undefined;
4
- let path = undefined;
5
- const middlewares = args.filter((arg) => {
6
- if (typeof arg === "string" && HTTP_METHODS.includes(arg)) {
7
- method = arg;
8
- return false;
9
- }
10
- if (typeof arg === "string" || arg instanceof RegExp) {
11
- path = arg ? arg : "/";
12
- return false;
13
- }
14
- return !!arg;
15
- });
16
- return {
17
- path,
18
- method,
19
- middlewares
20
- };
21
- }
22
- //# sourceMappingURL=mapUseOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapUseOptions.js","sourceRoot":"","sources":["../../../src/utils/mapUseOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C,MAAM,UAAU,aAAa,CAAC,IAAW;IACvC,IAAI,MAAM,GAAuB,SAAS,CAAC;IAC3C,IAAI,IAAI,GAAgC,SAAS,CAAC;IAElD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,EAAE;QAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACzD,MAAM,GAAG,GAAG,CAAC;YAEb,OAAO,KAAK,CAAC;SACd;QAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,YAAY,MAAM,EAAE;YACpD,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YAEvB,OAAO,KAAK,CAAC;SACd;QAED,OAAO,CAAC,CAAC,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI;QACJ,MAAM;QACN,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import {HTTP_METHODS} from \"../constants\";\n\nexport function mapUseOptions(args: any[]) {\n let method: string | undefined = undefined;\n let path: string | RegExp | undefined = undefined;\n\n const middlewares = args.filter((arg: any) => {\n if (typeof arg === \"string\" && HTTP_METHODS.includes(arg)) {\n method = arg;\n\n return false;\n }\n\n if (typeof arg === \"string\" || arg instanceof RegExp) {\n path = arg ? arg : \"/\";\n\n return false;\n }\n\n return !!arg;\n });\n\n return {\n path,\n method,\n middlewares\n };\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare function mapUseOptions(args: any[]): {
2
- path: undefined;
3
- method: undefined;
4
- middlewares: any[];
5
- };