@tsed/platform-middlewares 8.0.0-alpha.1 → 8.0.0-alpha.10

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.
Files changed (46) hide show
  1. package/lib/esm/decorators/authOptions.js.map +1 -1
  2. package/lib/esm/decorators/use.js.map +1 -1
  3. package/lib/esm/decorators/useAfter.js.map +1 -1
  4. package/lib/esm/decorators/useAuth.js.map +1 -1
  5. package/lib/esm/decorators/useBefore.js.map +1 -1
  6. package/lib/esm/decorators/useBeforeEach.js.map +1 -1
  7. package/lib/esm/utils/getMiddlewaresForHook.js.map +1 -1
  8. package/package.json +16 -17
  9. package/lib/cjs/constants/constants.js +0 -34
  10. package/lib/cjs/constants/constants.js.map +0 -1
  11. package/lib/cjs/decorators/authOptions.js +0 -44
  12. package/lib/cjs/decorators/authOptions.js.map +0 -1
  13. package/lib/cjs/decorators/middleware.js +0 -18
  14. package/lib/cjs/decorators/middleware.js.map +0 -1
  15. package/lib/cjs/decorators/use.js +0 -43
  16. package/lib/cjs/decorators/use.js.map +0 -1
  17. package/lib/cjs/decorators/useAfter.js +0 -46
  18. package/lib/cjs/decorators/useAfter.js.map +0 -1
  19. package/lib/cjs/decorators/useAuth.js +0 -45
  20. package/lib/cjs/decorators/useAuth.js.map +0 -1
  21. package/lib/cjs/decorators/useBefore.js +0 -45
  22. package/lib/cjs/decorators/useBefore.js.map +0 -1
  23. package/lib/cjs/decorators/useBeforeEach.js +0 -40
  24. package/lib/cjs/decorators/useBeforeEach.js.map +0 -1
  25. package/lib/cjs/domain/MiddlewareMethods.js +0 -3
  26. package/lib/cjs/domain/MiddlewareMethods.js.map +0 -1
  27. package/lib/cjs/domain/PlatformMiddlewareSettings.js +0 -3
  28. package/lib/cjs/domain/PlatformMiddlewareSettings.js.map +0 -1
  29. package/lib/cjs/index.js +0 -18
  30. package/lib/cjs/index.js.map +0 -1
  31. package/lib/cjs/package.json +0 -3
  32. package/lib/cjs/utils/getMiddlewaresForHook.js +0 -10
  33. package/lib/cjs/utils/getMiddlewaresForHook.js.map +0 -1
  34. package/lib/esm/package.json +0 -3
  35. package/lib/types-esm/constants/constants.d.ts +0 -1
  36. package/lib/types-esm/decorators/authOptions.d.ts +0 -23
  37. package/lib/types-esm/decorators/middleware.d.ts +0 -8
  38. package/lib/types-esm/decorators/use.d.ts +0 -22
  39. package/lib/types-esm/decorators/useAfter.d.ts +0 -21
  40. package/lib/types-esm/decorators/useAuth.d.ts +0 -22
  41. package/lib/types-esm/decorators/useBefore.d.ts +0 -21
  42. package/lib/types-esm/decorators/useBeforeEach.d.ts +0 -21
  43. package/lib/types-esm/domain/MiddlewareMethods.d.ts +0 -3
  44. package/lib/types-esm/domain/PlatformMiddlewareSettings.d.ts +0 -18
  45. package/lib/types-esm/index.d.ts +0 -14
  46. package/lib/types-esm/utils/getMiddlewaresForHook.d.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"authOptions.js","sourceRoot":"","sources":["../../../src/decorators/authOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGjB,eAAe,EACf,cAAc,EAEd,wBAAwB,EACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,SAAoB,EAAE,UAAmC,EAAE;IACrF,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,cAAc,CAAC,MAAM;gBACxB,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;oBAE3B,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"authOptions.js","sourceRoot":"","sources":["../../../src/decorators/authOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGjB,eAAe,EACf,cAAc,EAEd,wBAAwB,EACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,SAAoB,EAAE,UAAmC,EAAE;IACrF,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,KAAK,cAAc,CAAC,MAAM;gBACxB,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;oBAE3B,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/decorators/use.ts"],"names":[],"mappings":"AA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MAAM,IAAI,wBAAwB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACxD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAfter.js","sourceRoot":"","sources":["../../../src/decorators/useAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAG,IAAW;IACrC,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,cAAc,CAAC,MAAM;gBACxB,MAAM,QAAQ,GAAG,MAAM,CAAC;gBACxB,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;gBAEnE,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACvB,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;gBAE1D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE;oBAC9B,GAAG,WAAW;oBACd,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;iBACrD,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SAC5D;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"useAfter.js","sourceRoot":"","sources":["../../../src/decorators/useAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAA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,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;iBACvD,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;SAC7D;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"useBefore.js","sourceRoot":"","sources":["../../../src/decorators/useBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,wBAAwB,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,SAAS,CAAC,GAAG,IAAW;IACtC,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE,CAAC;YAC7B,KAAK,cAAc,CAAC,MAAM;gBACxB,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAEjE,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACvB,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;gBAE1D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE;oBAC9B,GAAG,WAAW;oBACd,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;iBACvD,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBeforeEach.js","sourceRoot":"","sources":["../../../src/decorators/useBeforeEach.ts"],"names":[],"mappings":"AAAA,OAAO,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CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;gBACxD,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":"AAGA,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,CAAqC,aAAa,EAAE,EAAE,CAAC,CAAC;IAExF,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtG,CAAC"}
1
+ {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":"AAIA,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,CAAqC,aAAa,EAAE,EAAE,CAAC,CAAC;IAExF,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtG,CAAC"}
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@tsed/platform-middlewares",
3
3
  "description": "Middlewares module for Ts.ED Framework",
4
- "type": "commonjs",
5
- "version": "8.0.0-alpha.1",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.10",
6
6
  "source": "./src/index.ts",
7
- "main": "./lib/cjs/index.js",
7
+ "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./lib/types/index.d.ts",
13
13
  "import": "./lib/esm/index.js",
14
- "require": "./lib/cjs/index.js",
15
- "default": "./lib/cjs/index.js"
14
+ "default": "./lib/esm/index.js"
16
15
  }
17
16
  },
18
17
  "scripts": {
@@ -23,22 +22,22 @@
23
22
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
24
23
  },
25
24
  "dependencies": {
26
- "tslib": "2.6.1"
25
+ "tslib": "2.7.0"
27
26
  },
28
27
  "devDependencies": {
29
- "@tsed/barrels": "8.0.0-alpha.1",
30
- "@tsed/core": "8.0.0-alpha.1",
31
- "@tsed/di": "8.0.0-alpha.1",
32
- "@tsed/schema": "8.0.0-alpha.1",
33
- "@tsed/typescript": "8.0.0-alpha.1",
34
- "eslint": "^8.57.0",
35
- "typescript": "4.9.5",
36
- "vitest": "2.0.4"
28
+ "@tsed/barrels": "8.0.0-alpha.10",
29
+ "@tsed/core": "8.0.0-alpha.10",
30
+ "@tsed/di": "8.0.0-alpha.10",
31
+ "@tsed/schema": "8.0.0-alpha.10",
32
+ "@tsed/typescript": "8.0.0-alpha.10",
33
+ "eslint": "9.12.0",
34
+ "typescript": "5.4.5",
35
+ "vitest": "2.1.2"
37
36
  },
38
37
  "peerDependencies": {
39
- "@tsed/core": "8.0.0-alpha.1",
40
- "@tsed/di": "8.0.0-alpha.1",
41
- "@tsed/schema": "8.0.0-alpha.1"
38
+ "@tsed/core": "8.0.0-alpha.10",
39
+ "@tsed/di": "8.0.0-alpha.10",
40
+ "@tsed/schema": "8.0.0-alpha.10"
42
41
  },
43
42
  "peerDependenciesMeta": {
44
43
  "@tsed/core": {
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTP_METHODS = void 0;
4
- exports.HTTP_METHODS = [
5
- "all",
6
- "checkout",
7
- "connect",
8
- "copy",
9
- "delete",
10
- "get",
11
- "head",
12
- "lock",
13
- "merge",
14
- "mkactivity",
15
- "mkcol",
16
- "move",
17
- "m-search",
18
- "notify",
19
- "options",
20
- "param",
21
- "patch",
22
- "post",
23
- "propfind",
24
- "propatch",
25
- "purge",
26
- "put",
27
- "report",
28
- "search",
29
- "subscribe",
30
- "trace",
31
- "unlock",
32
- "unsuscribe"
33
- ];
34
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
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"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthOptions = void 0;
4
- const core_1 = require("@tsed/core");
5
- const schema_1 = require("@tsed/schema");
6
- /**
7
- * Change authentication options.
8
- *
9
- * ```typescript
10
- * @Controller('/mypath')
11
- * @UseAuth(MyAuthStrategy, {role: ''})
12
- * class MyCtrl {
13
- *
14
- * @Get('/')
15
- * @AuthOptions(MyAuthStrategy, {role: 'admin'})
16
- * public getResource(){}
17
- * }
18
- * ```
19
- *
20
- * @param guardAuth
21
- * @param options {Object} Object passed to the customer auth strategy
22
- * @returns {Function}
23
- * @decorator
24
- * @decorator
25
- * @operation
26
- */
27
- function AuthOptions(guardAuth, options = {}) {
28
- return (...args) => {
29
- switch ((0, core_1.decoratorTypeOf)(args)) {
30
- case core_1.DecoratorTypes.METHOD:
31
- return (0, schema_1.JsonEntityFn)((entity) => {
32
- const store = entity.store;
33
- store.merge(guardAuth, options, true);
34
- })(...args);
35
- case core_1.DecoratorTypes.CLASS:
36
- (0, core_1.decorateMethodsOf)(args[0], AuthOptions(guardAuth, options));
37
- break;
38
- default:
39
- throw new core_1.UnsupportedDecoratorType(AuthOptions, args);
40
- }
41
- };
42
- }
43
- exports.AuthOptions = AuthOptions;
44
- //# sourceMappingURL=authOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authOptions.js","sourceRoot":"","sources":["../../../src/decorators/authOptions.ts"],"names":[],"mappings":";;;AAAA,qCAQoB;AACpB,yCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,SAAoB,EAAE,UAAmC,EAAE;IACrF,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,EAAE;oBAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;oBAE3B,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC;AAlBD,kCAkBC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Middleware = void 0;
4
- const di_1 = require("@tsed/di");
5
- /**
6
- * Register a new Middleware class.
7
- *
8
- * @decorator
9
- * @classDecorator
10
- */
11
- function Middleware(opts) {
12
- return (0, di_1.Injectable)({
13
- ...opts,
14
- type: di_1.ProviderType.MIDDLEWARE
15
- });
16
- }
17
- exports.Middleware = Middleware;
18
- //# sourceMappingURL=middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/decorators/middleware.ts"],"names":[],"mappings":";;;AAAA,iCAAgE;AAEhE;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAA0C;IACnE,OAAO,IAAA,eAAU,EAAC;QAChB,GAAG,IAAI;QACP,IAAI,EAAE,iBAAY,CAAC,UAAU;KAC9B,CAAC,CAAC;AACL,CAAC;AALD,gCAKC"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Use = void 0;
4
- const core_1 = require("@tsed/core");
5
- const schema_1 = require("@tsed/schema");
6
- /**
7
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
8
- * the base of the requested path matches `path.
9
- *
10
- * ```typescript
11
- * @Controller('/')
12
- * @Use(Middleware1)
13
- * export class Ctrl {
14
- *
15
- * @Get('/')
16
- * @Use(Middleware2)
17
- * get() { }
18
- * }
19
- *
20
- * ```
21
- *
22
- * @returns {Function}
23
- * @param args
24
- * @decorator
25
- * @operation
26
- */
27
- function Use(...args) {
28
- return (0, schema_1.JsonEntityFn)((entity, parameters) => {
29
- switch (entity.decoratorType) {
30
- case core_1.DecoratorTypes.METHOD:
31
- return (0, schema_1.Operation)(...args);
32
- case core_1.DecoratorTypes.CLASS:
33
- entity.store.merge("middlewares", {
34
- use: args
35
- });
36
- break;
37
- default:
38
- throw new core_1.UnsupportedDecoratorType(Use, parameters);
39
- }
40
- });
41
- }
42
- exports.Use = Use;
43
- //# sourceMappingURL=use.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/decorators/use.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yCAAqD;AAErD;;;;;;;;;;;;;;;;;;;;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,kBAAS,EAAC,GAAG,IAAI,CAAC,CAAC;YAE5B,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"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseAfter = void 0;
4
- const core_1 = require("@tsed/core");
5
- const schema_1 = require("@tsed/schema");
6
- /**
7
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
8
- * the base of the requested path matches `path.
9
- *
10
- * ```typescript
11
- * @Controller('/')
12
- * @UseAfter(Middleware1)
13
- * export class Ctrl {
14
- *
15
- * @Get('/')
16
- * @UseAfter(Middleware2)
17
- * get() { }
18
- * }
19
- * ```
20
- *
21
- * @returns {function(any, any, any): *}
22
- * @param args
23
- * @decorator
24
- * @operation
25
- */
26
- function UseAfter(...args) {
27
- return (0, schema_1.JsonEntityFn)((entity, parameters) => {
28
- switch (entity.decoratorType) {
29
- case core_1.DecoratorTypes.METHOD:
30
- const endpoint = entity;
31
- endpoint.afterMiddlewares = args.concat(endpoint.afterMiddlewares);
32
- break;
33
- case core_1.DecoratorTypes.CLASS:
34
- const middlewares = entity.store.get("middlewares") || {};
35
- entity.store.set("middlewares", {
36
- ...middlewares,
37
- useAfter: [...args, ...(middlewares.useAfter || [])]
38
- });
39
- break;
40
- default:
41
- throw new core_1.UnsupportedDecoratorType(UseAfter, parameters);
42
- }
43
- });
44
- }
45
- exports.UseAfter = UseAfter;
46
- //# sourceMappingURL=useAfter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAfter.js","sourceRoot":"","sources":["../../../src/decorators/useAfter.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,QAAQ,CAAC,GAAG,IAAW;IACrC,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,qBAAc,CAAC,MAAM;gBACxB,MAAM,QAAQ,GAAG,MAAM,CAAC;gBACxB,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;gBAEnE,MAAM;YAER,KAAK,qBAAc,CAAC,KAAK;gBACvB,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;gBAE1D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE;oBAC9B,GAAG,WAAW;oBACd,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;iBACrD,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SAC5D;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAtBD,4BAsBC"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseAuth = void 0;
4
- const core_1 = require("@tsed/core");
5
- const authOptions_js_1 = require("./authOptions.js");
6
- const useBefore_js_1 = require("./useBefore.js");
7
- /**
8
- * Use custom authentication strategy on your endpoint.
9
- *
10
- * ```typescript
11
- * @Controller('/mypath')
12
- * @UseAuth(MyAuthStrategy)
13
- * class MyCtrl {
14
- *
15
- * @Get('/')
16
- * @UseAuth(MyAuthStrategy, {role: 'admin'})
17
- * public getResource(){}
18
- * }
19
- * ```
20
- *
21
- * @param guardAuth {Type<any>} A middleware which implement a custom auth strategy
22
- * @param options {Object} Object passed to the customer auth strategy
23
- * @returns {Function}
24
- * @decorator
25
- * @operation
26
- */
27
- function UseAuth(guardAuth, options = {}) {
28
- return (...args) => {
29
- switch ((0, core_1.decoratorTypeOf)(args)) {
30
- case core_1.DecoratorTypes.METHOD:
31
- return (0, core_1.useDecorators)((0, core_1.StoreFn)((store) => {
32
- if (!store.has(guardAuth)) {
33
- return (0, useBefore_js_1.UseBefore)(guardAuth);
34
- }
35
- }), (0, authOptions_js_1.AuthOptions)(guardAuth, options))(...args);
36
- case core_1.DecoratorTypes.CLASS:
37
- (0, core_1.decorateMethodsOf)(args[0], UseAuth(guardAuth, options));
38
- break;
39
- default:
40
- throw new core_1.UnsupportedDecoratorType(UseAuth, args);
41
- }
42
- };
43
- }
44
- exports.UseAuth = UseAuth;
45
- //# sourceMappingURL=useAuth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../../src/decorators/useAuth.ts"],"names":[],"mappings":";;;AAAA,qCAUoB;AACpB,qDAA6C;AAC7C,iDAAyC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,OAAO,CAAC,SAAoB,EAAE,UAAmC,EAAE;IACjF,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,oBAAa,EAClB,IAAA,cAAO,EAAC,CAAC,KAAY,EAAE,EAAE;oBACvB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;wBACzB,OAAO,IAAA,wBAAS,EAAC,SAAS,CAAC,CAAC;qBAC7B;gBACH,CAAC,CAAC,EACF,IAAA,4BAAW,EAAC,SAAS,EAAE,OAAO,CAAC,CAChC,CAAC,GAAG,IAAI,CAAC,CAAC;YAEb,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBACxD,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACrD;IACH,CAAC,CAAC;AACJ,CAAC;AArBD,0BAqBC"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseBefore = void 0;
4
- const core_1 = require("@tsed/core");
5
- const schema_1 = require("@tsed/schema");
6
- /**
7
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
8
- * the base of the requested path matches `path.
9
- *
10
- * ```typescript
11
- * @Controller('/')
12
- * @UseBefore(Middleware1) // called only one time before all endpoint
13
- * export class Ctrl {
14
- *
15
- * @Get('/')
16
- * @UseBefore(Middleware2)
17
- * get() { }
18
- * }
19
- * ```
20
- *
21
- * @returns {function(any, any, any): *}
22
- * @param args
23
- * @decorator
24
- * @operation
25
- */
26
- function UseBefore(...args) {
27
- return (0, schema_1.JsonEntityFn)((entity, parameters) => {
28
- switch (entity.decoratorType) {
29
- case core_1.DecoratorTypes.METHOD:
30
- entity.beforeMiddlewares = args.concat(entity.beforeMiddlewares);
31
- break;
32
- case core_1.DecoratorTypes.CLASS:
33
- const middlewares = entity.store.get("middlewares") || {};
34
- entity.store.set("middlewares", {
35
- ...middlewares,
36
- useBefore: [...args, ...(middlewares.useBefore || [])]
37
- });
38
- break;
39
- default:
40
- throw new core_1.UnsupportedDecoratorType(UseBefore, parameters);
41
- }
42
- });
43
- }
44
- exports.UseBefore = UseBefore;
45
- //# sourceMappingURL=useBefore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBefore.js","sourceRoot":"","sources":["../../../src/decorators/useBefore.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,yCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,SAAS,CAAC,GAAG,IAAW;IACtC,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACzC,QAAQ,MAAM,CAAC,aAAa,EAAE;YAC5B,KAAK,qBAAc,CAAC,MAAM;gBACxB,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAEjE,MAAM;YAER,KAAK,qBAAc,CAAC,KAAK;gBACvB,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;gBAE1D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE;oBAC9B,GAAG,WAAW;oBACd,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;iBACvD,CAAC,CAAC;gBACH,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;SAC7D;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,8BAqBC"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseBeforeEach = void 0;
4
- const core_1 = require("@tsed/core");
5
- const useBefore_js_1 = require("./useBefore.js");
6
- /**
7
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
8
- * the base of the requested path matches `path.
9
- *
10
- * ```typescript
11
- * @Controller('/')
12
- * @UseBeforeEach(Middleware1) // Called before each endpoint
13
- * export class Ctrl {
14
- *
15
- * @Get('/')
16
- * get() { }
17
- * }
18
- *
19
- * ```
20
- *
21
- * @returns {Function}
22
- * @param args
23
- * @decorator
24
- * @operation
25
- */
26
- function UseBeforeEach(...args) {
27
- return (...decoratorArgs) => {
28
- switch ((0, core_1.decoratorTypeOf)(decoratorArgs)) {
29
- case core_1.DecoratorTypes.METHOD:
30
- return (0, useBefore_js_1.UseBefore)(...args)(...decoratorArgs);
31
- case core_1.DecoratorTypes.CLASS:
32
- (0, core_1.decorateMethodsOf)(decoratorArgs[0], (0, useBefore_js_1.UseBefore)(...args));
33
- break;
34
- default:
35
- throw new core_1.UnsupportedDecoratorType(UseBeforeEach, decoratorArgs);
36
- }
37
- };
38
- }
39
- exports.UseBeforeEach = UseBeforeEach;
40
- //# sourceMappingURL=useBeforeEach.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBeforeEach.js","sourceRoot":"","sources":["../../../src/decorators/useBeforeEach.ts"],"names":[],"mappings":";;;AAAA,qCAA6H;AAC7H,iDAAyC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,aAAa,CAAC,GAAG,IAAW;IAC1C,OAAO,CAAI,GAAG,aAAkC,EAAqC,EAAE;QACrF,QAAQ,IAAA,sBAAe,EAAC,aAAa,CAAC,EAAE;YACtC,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,wBAAS,EAAC,GAAG,IAAI,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;YAE9C,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAA,wBAAS,EAAC,GAAG,IAAI,CAAC,CAAC,CAAC;gBACxD,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;SACpE;IACH,CAAC,CAAC;AACJ,CAAC;AAdD,sCAcC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=MiddlewareMethods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MiddlewareMethods.js","sourceRoot":"","sources":["../../../src/domain/MiddlewareMethods.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PlatformMiddlewareSettings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformMiddlewareSettings.js","sourceRoot":"","sources":["../../../src/domain/PlatformMiddlewareSettings.ts"],"names":[],"mappings":""}
package/lib/cjs/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @file Automatically generated by @tsed/barrels.
6
- */
7
- tslib_1.__exportStar(require("./constants/constants.js"), exports);
8
- tslib_1.__exportStar(require("./decorators/authOptions.js"), exports);
9
- tslib_1.__exportStar(require("./decorators/middleware.js"), exports);
10
- tslib_1.__exportStar(require("./decorators/use.js"), exports);
11
- tslib_1.__exportStar(require("./decorators/useAfter.js"), exports);
12
- tslib_1.__exportStar(require("./decorators/useAuth.js"), exports);
13
- tslib_1.__exportStar(require("./decorators/useBefore.js"), exports);
14
- tslib_1.__exportStar(require("./decorators/useBeforeEach.js"), exports);
15
- tslib_1.__exportStar(require("./domain/MiddlewareMethods.js"), exports);
16
- tslib_1.__exportStar(require("./domain/PlatformMiddlewareSettings.js"), exports);
17
- tslib_1.__exportStar(require("./utils/getMiddlewaresForHook.js"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAAyC;AACzC,sEAA4C;AAC5C,qEAA2C;AAC3C,8DAAoC;AACpC,mEAAyC;AACzC,kEAAwC;AACxC,oEAA0C;AAC1C,wEAA8C;AAC9C,wEAA8C;AAC9C,iFAAuD;AACvD,2EAAiD"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMiddlewaresForHook = void 0;
4
- function getMiddlewaresForHook(hook, settings, defaultHook = "") {
5
- const env = settings.env;
6
- const middlewares = settings.get("middlewares", []);
7
- return middlewares.filter((options) => options.use && options.env === env && options.hook === hook);
8
- }
9
- exports.getMiddlewaresForHook = getMiddlewaresForHook;
10
- //# sourceMappingURL=getMiddlewaresForHook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMiddlewaresForHook.js","sourceRoot":"","sources":["../../../src/utils/getMiddlewaresForHook.ts"],"names":[],"mappings":";;;AAGA,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,CAAqC,aAAa,EAAE,EAAE,CAAC,CAAC;IAExF,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtG,CAAC;AALD,sDAKC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1 +0,0 @@
1
- export declare const HTTP_METHODS: string[];
@@ -1,23 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- /**
3
- * Change authentication options.
4
- *
5
- * ```typescript
6
- * @Controller('/mypath')
7
- * @UseAuth(MyAuthStrategy, {role: ''})
8
- * class MyCtrl {
9
- *
10
- * @Get('/')
11
- * @AuthOptions(MyAuthStrategy, {role: 'admin'})
12
- * public getResource(){}
13
- * }
14
- * ```
15
- *
16
- * @param guardAuth
17
- * @param options {Object} Object passed to the customer auth strategy
18
- * @returns {Function}
19
- * @decorator
20
- * @decorator
21
- * @operation
22
- */
23
- export declare function AuthOptions(guardAuth: Type<any>, options?: Record<string, unknown>): Function;
@@ -1,8 +0,0 @@
1
- import { ProviderOpts } from "@tsed/di";
2
- /**
3
- * Register a new Middleware class.
4
- *
5
- * @decorator
6
- * @classDecorator
7
- */
8
- export declare function Middleware(opts?: Partial<Omit<ProviderOpts, "type">>): ClassDecorator;
@@ -1,22 +0,0 @@
1
- /**
2
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
3
- * the base of the requested path matches `path.
4
- *
5
- * ```typescript
6
- * @Controller('/')
7
- * @Use(Middleware1)
8
- * export class Ctrl {
9
- *
10
- * @Get('/')
11
- * @Use(Middleware2)
12
- * get() { }
13
- * }
14
- *
15
- * ```
16
- *
17
- * @returns {Function}
18
- * @param args
19
- * @decorator
20
- * @operation
21
- */
22
- export declare function Use(...args: any[]): Function;
@@ -1,21 +0,0 @@
1
- /**
2
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
3
- * the base of the requested path matches `path.
4
- *
5
- * ```typescript
6
- * @Controller('/')
7
- * @UseAfter(Middleware1)
8
- * export class Ctrl {
9
- *
10
- * @Get('/')
11
- * @UseAfter(Middleware2)
12
- * get() { }
13
- * }
14
- * ```
15
- *
16
- * @returns {function(any, any, any): *}
17
- * @param args
18
- * @decorator
19
- * @operation
20
- */
21
- export declare function UseAfter(...args: any[]): Function;
@@ -1,22 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- /**
3
- * Use custom authentication strategy on your endpoint.
4
- *
5
- * ```typescript
6
- * @Controller('/mypath')
7
- * @UseAuth(MyAuthStrategy)
8
- * class MyCtrl {
9
- *
10
- * @Get('/')
11
- * @UseAuth(MyAuthStrategy, {role: 'admin'})
12
- * public getResource(){}
13
- * }
14
- * ```
15
- *
16
- * @param guardAuth {Type<any>} A middleware which implement a custom auth strategy
17
- * @param options {Object} Object passed to the customer auth strategy
18
- * @returns {Function}
19
- * @decorator
20
- * @operation
21
- */
22
- export declare function UseAuth(guardAuth: Type<any>, options?: Record<string, unknown>): Function;
@@ -1,21 +0,0 @@
1
- /**
2
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
3
- * the base of the requested path matches `path.
4
- *
5
- * ```typescript
6
- * @Controller('/')
7
- * @UseBefore(Middleware1) // called only one time before all endpoint
8
- * export class Ctrl {
9
- *
10
- * @Get('/')
11
- * @UseBefore(Middleware2)
12
- * get() { }
13
- * }
14
- * ```
15
- *
16
- * @returns {function(any, any, any): *}
17
- * @param args
18
- * @decorator
19
- * @operation
20
- */
21
- export declare function UseBefore(...args: any[]): Function;
@@ -1,21 +0,0 @@
1
- /**
2
- * Mounts the specified middleware function or functions at the specified path: the middleware function is executed when
3
- * the base of the requested path matches `path.
4
- *
5
- * ```typescript
6
- * @Controller('/')
7
- * @UseBeforeEach(Middleware1) // Called before each endpoint
8
- * export class Ctrl {
9
- *
10
- * @Get('/')
11
- * get() { }
12
- * }
13
- *
14
- * ```
15
- *
16
- * @returns {Function}
17
- * @param args
18
- * @decorator
19
- * @operation
20
- */
21
- export declare function UseBeforeEach(...args: any[]): Function;
@@ -1,3 +0,0 @@
1
- export interface MiddlewareMethods {
2
- use(...args: any[]): void | any | Promise<any>;
3
- }
@@ -1,18 +0,0 @@
1
- import { Env, Type } from "@tsed/core";
2
- export type PlatformMiddlewareLoadingOptions = {
3
- env?: Env;
4
- use: Function | Type<any> | string;
5
- hook?: string;
6
- options?: any;
7
- };
8
- export type PlatformMiddlewareSettings = Function | Type<any> | PlatformMiddlewareLoadingOptions | string | any;
9
- declare global {
10
- namespace TsED {
11
- interface Configuration {
12
- /**
13
- * Load middlewares on the $beforeRoutesInit hook (or on the specified hook event name).
14
- */
15
- middlewares: PlatformMiddlewareSettings[];
16
- }
17
- }
18
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
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";
@@ -1,3 +0,0 @@
1
- import { DIConfiguration } from "@tsed/di";
2
- import { PlatformMiddlewareLoadingOptions } from "../domain/PlatformMiddlewareSettings.js";
3
- export declare function getMiddlewaresForHook(hook: string, settings: DIConfiguration, defaultHook?: string): PlatformMiddlewareLoadingOptions[];