koatty_router 1.7.12 → 1.8.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.8.0](https://github.com/koatty/koatty_router/compare/v1.7.12...v1.8.0) (2022-11-12)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * httpRouter与wsRouter使用了错误的加载方式 ([94d111c](https://github.com/koatty/koatty_router/commit/94d111cc321d80b3098a3abcb999ca64d0cc4f95))
11
+
5
12
  ### [1.7.12](https://github.com/koatty/koatty_router/compare/v1.7.10...v1.7.12) (2022-11-01)
6
13
 
7
14
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-11-01 15:47:40
3
+ * @Date: 2022-11-13 00:14:09
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-11-01 15:47:18
3
+ * @Date: 2022-11-13 00:13:55
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -576,14 +576,11 @@ class HttpRouter {
576
576
  const path = router.path;
577
577
  const requestMethod = router.requestMethod;
578
578
  const params = ctlParams[method];
579
- // websocket only handler get request
580
- if (requestMethod == exports.RequestMethod.GET || requestMethod == exports.RequestMethod.ALL) {
581
- koatty_logger.DefaultLogger.Debug(`Register request mapping: [${requestMethod}] : ["${path}" => ${n}.${method}]`);
582
- this.SetRouter(path, (ctx) => {
583
- const ctl = koatty_container.IOCContainer.getInsByClass(ctlClass, [ctx]);
584
- return Handler(this.app, ctx, ctl, method, params);
585
- }, requestMethod);
586
- }
579
+ koatty_logger.DefaultLogger.Debug(`Register request mapping: ["${path}" => ${n}.${method}]`);
580
+ this.SetRouter(path, (ctx) => {
581
+ const ctl = koatty_container.IOCContainer.getInsByClass(ctlClass, [ctx]);
582
+ return Handler(this.app, ctx, ctl, method, params);
583
+ }, requestMethod);
587
584
  }
588
585
  }
589
586
  // exp: in middleware
@@ -656,11 +653,14 @@ class WebsocketRouter {
656
653
  const method = router.method;
657
654
  const requestMethod = router.requestMethod;
658
655
  const params = ctlParams[method];
659
- koatty_logger.DefaultLogger.Debug(`Register request mapping: ["${path}" => ${n}.${method}]`);
660
- this.SetRouter(path, (ctx) => {
661
- const ctl = koatty_container.IOCContainer.getInsByClass(ctlClass, [ctx]);
662
- return Handler(this.app, ctx, ctl, method, params);
663
- }, requestMethod);
656
+ // websocket only handler get request
657
+ if (requestMethod == exports.RequestMethod.GET || requestMethod == exports.RequestMethod.ALL) {
658
+ koatty_logger.DefaultLogger.Debug(`Register request mapping: [${requestMethod}] : ["${path}" => ${n}.${method}]`);
659
+ this.SetRouter(path, (ctx) => {
660
+ const ctl = koatty_container.IOCContainer.getInsByClass(ctlClass, [ctx]);
661
+ return Handler(this.app, ctx, ctl, method, params);
662
+ }, requestMethod);
663
+ }
664
664
  }
665
665
  }
666
666
  // Add websocket handler
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2022-11-01 15:47:18
3
+ * @Date: 2022-11-13 00:13:55
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -550,14 +550,11 @@ class HttpRouter {
550
550
  const path = router.path;
551
551
  const requestMethod = router.requestMethod;
552
552
  const params = ctlParams[method];
553
- // websocket only handler get request
554
- if (requestMethod == RequestMethod.GET || requestMethod == RequestMethod.ALL) {
555
- DefaultLogger.Debug(`Register request mapping: [${requestMethod}] : ["${path}" => ${n}.${method}]`);
556
- this.SetRouter(path, (ctx) => {
557
- const ctl = IOCContainer.getInsByClass(ctlClass, [ctx]);
558
- return Handler(this.app, ctx, ctl, method, params);
559
- }, requestMethod);
560
- }
553
+ DefaultLogger.Debug(`Register request mapping: ["${path}" => ${n}.${method}]`);
554
+ this.SetRouter(path, (ctx) => {
555
+ const ctl = IOCContainer.getInsByClass(ctlClass, [ctx]);
556
+ return Handler(this.app, ctx, ctl, method, params);
557
+ }, requestMethod);
561
558
  }
562
559
  }
563
560
  // exp: in middleware
@@ -630,11 +627,14 @@ class WebsocketRouter {
630
627
  const method = router.method;
631
628
  const requestMethod = router.requestMethod;
632
629
  const params = ctlParams[method];
633
- DefaultLogger.Debug(`Register request mapping: ["${path}" => ${n}.${method}]`);
634
- this.SetRouter(path, (ctx) => {
635
- const ctl = IOCContainer.getInsByClass(ctlClass, [ctx]);
636
- return Handler(this.app, ctx, ctl, method, params);
637
- }, requestMethod);
630
+ // websocket only handler get request
631
+ if (requestMethod == RequestMethod.GET || requestMethod == RequestMethod.ALL) {
632
+ DefaultLogger.Debug(`Register request mapping: [${requestMethod}] : ["${path}" => ${n}.${method}]`);
633
+ this.SetRouter(path, (ctx) => {
634
+ const ctl = IOCContainer.getInsByClass(ctlClass, [ctx]);
635
+ return Handler(this.app, ctx, ctl, method, params);
636
+ }, requestMethod);
637
+ }
638
638
  }
639
639
  }
640
640
  // Add websocket handler
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty_router",
3
- "version": "1.7.12",
3
+ "version": "1.8.0",
4
4
  "description": "Koatty routing component, adapt to http1/2, websocket, gRPC.",
5
5
  "scripts": {
6
6
  "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
@@ -12,6 +12,7 @@
12
12
  "prepublishOnly": "npm test && npm run build",
13
13
  "prerelease": "npm test && npm run build",
14
14
  "release": "standard-version",
15
+ "release:minor": "npm run release -- --release-as minor",
15
16
  "test": "npm run eslint && jest --passWithNoTests"
16
17
  },
17
18
  "main": "./dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koatty_router",
3
- "version": "1.7.12",
3
+ "version": "1.8.0",
4
4
  "description": "Koatty routing component, adapt to http1/2, websocket, gRPC.",
5
5
  "scripts": {
6
6
  "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
@@ -12,6 +12,7 @@
12
12
  "prepublishOnly": "npm test && npm run build",
13
13
  "prerelease": "npm test && npm run build",
14
14
  "release": "standard-version",
15
+ "release:minor": "npm run release -- --release-as minor",
15
16
  "test": "npm run eslint && jest --passWithNoTests"
16
17
  },
17
18
  "main": "./dist/index.js",