@tsed/swagger 7.61.1 → 7.62.0

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.
@@ -41,7 +41,7 @@ let SwaggerModule = class SwaggerModule {
41
41
  const urls = this.getUrls();
42
42
  this.settings.forEach((conf) => {
43
43
  const { path = "/" } = conf;
44
- this.app.get(path, (0, platform_router_1.useContextHandler)((0, redirectMiddleware_1.redirectMiddleware)(path)));
44
+ this.app.use(path, (0, platform_router_1.useContextHandler)((0, redirectMiddleware_1.redirectMiddleware)(path)));
45
45
  this.app.use(path, this.createRouter(conf, urls));
46
46
  });
47
47
  this.loaded = true;
@@ -7,7 +7,7 @@ exports.redirectMiddleware = void 0;
7
7
  */
8
8
  function redirectMiddleware(path) {
9
9
  return (ctx) => {
10
- if (ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
10
+ if (ctx.request.method?.toUpperCase() === "GET" && ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
11
11
  ctx.response.redirect(302, `${path}/`);
12
12
  }
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC7D,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC;AAND,gDAMC"}
1
+ {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5G,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC;AAND,gDAMC"}
@@ -38,7 +38,7 @@ let SwaggerModule = class SwaggerModule {
38
38
  const urls = this.getUrls();
39
39
  this.settings.forEach((conf) => {
40
40
  const { path = "/" } = conf;
41
- this.app.get(path, useContextHandler(redirectMiddleware(path)));
41
+ this.app.use(path, useContextHandler(redirectMiddleware(path)));
42
42
  this.app.use(path, this.createRouter(conf, urls));
43
43
  });
44
44
  this.loaded = true;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export function redirectMiddleware(path) {
6
6
  return (ctx) => {
7
- if (ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
7
+ if (ctx.request.method?.toUpperCase() === "GET" && ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
8
8
  ctx.response.redirect(302, `${path}/`);
9
9
  }
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC7D,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5G,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/swagger",
3
- "version": "7.61.1",
3
+ "version": "7.62.0",
4
4
  "description": "Swagger package for Ts.ED framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/cjs/index.js",
@@ -18,13 +18,11 @@
18
18
  "barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
19
19
  "start": "ts-node test/app/index.ts",
20
20
  "test": "cross-env NODE_ENV=test yarn jest --max-workers=2 && jest-coverage-thresholds-bumper",
21
- "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json",
22
- "lint": "eslint '**/*.{ts,js}'",
23
- "lint:fix": "eslint '**/*.{ts,js}' --fix"
21
+ "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json"
24
22
  },
25
23
  "dependencies": {
26
- "@tsed/normalize-path": "7.61.1",
27
- "@tsed/openspec": "7.61.1",
24
+ "@tsed/normalize-path": "7.62.0",
25
+ "@tsed/openspec": "7.62.0",
28
26
  "filedirname": "^2.7.0",
29
27
  "fs-extra": "11.1.1",
30
28
  "micromatch": "4.0.5",
@@ -32,21 +30,20 @@
32
30
  "tslib": "2.6.1"
33
31
  },
34
32
  "devDependencies": {
35
- "@tsed/common": "7.61.1",
36
- "@tsed/core": "7.61.1",
37
- "@tsed/di": "7.61.1",
38
- "@tsed/eslint": "7.61.1",
39
- "@tsed/json-mapper": "7.61.1",
40
- "@tsed/openspec": "7.61.1",
41
- "@tsed/schema": "7.61.1",
42
- "@tsed/typescript": "7.61.1",
33
+ "@tsed/common": "7.62.0",
34
+ "@tsed/core": "7.62.0",
35
+ "@tsed/di": "7.62.0",
36
+ "@tsed/json-mapper": "7.62.0",
37
+ "@tsed/openspec": "7.62.0",
38
+ "@tsed/schema": "7.62.0",
39
+ "@tsed/typescript": "7.62.0",
43
40
  "@types/swagger-ui-dist": ">=3.30.1",
44
41
  "barrelsby": "^2.8.1",
45
42
  "eslint": "^8.12.0",
46
43
  "jest": "^29.2.0"
47
44
  },
48
45
  "peerDependencies": {
49
- "@tsed/common": "7.61.1"
46
+ "@tsed/common": "7.62.0"
50
47
  },
51
48
  "peerDependenciesMeta": {
52
49
  "@tsed/common": {
package/.eslintignore DELETED
@@ -1,13 +0,0 @@
1
- node_modules
2
- docs
3
- docs-references
4
- lib
5
- dist
6
- coverage
7
- .nyc_output
8
- *-lock.json
9
- *.lock
10
- benchmarks.*
11
- **/generated
12
-
13
- **/*.js
package/.eslintrc.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("@tsed/eslint/node.js");