koatty 3.9.1-3 → 3.9.2

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/README.md CHANGED
@@ -1,162 +1,162 @@
1
- # koatty
2
-
3
- Koa2 + Typescript + IOC = koatty.
4
-
5
- Use Typescript's decorator implement IOC and AOP.
6
-
7
- [![Version npm](https://img.shields.io/npm/v/koatty.svg?style=flat-square)](https://www.npmjs.com/package/koatty)[![npm Downloads](https://img.shields.io/npm/dm/koatty.svg?style=flat-square)](https://npmcharts.com/compare/koatty?minimal=true)
8
-
9
- ## New features
10
-
11
- * HTTP、HTTPS、HTTP2、gRPC、WebSocket server.
12
- * Support loading environment configuration, parsing command line parameters (process.argv) and environment variables (process.env)
13
- * `@ExceptionHandler()` Register global exception handling
14
- * graceful shutdown and pre-exit event
15
-
16
-
17
- ## Documentation
18
-
19
- [koatty_doc_CN](https://koatty.org/) (In progress💪)
20
-
21
-
22
- ## Installation CLI tools
23
-
24
- ```shell
25
- npm i -g koatty_cli
26
- ```
27
-
28
- ## Quick Start
29
-
30
- ### 1.Create Project
31
-
32
- ```shell
33
- kt new projectName
34
-
35
- npm start
36
- ```
37
-
38
- ### 2. Install deps
39
-
40
- ```
41
- cd ./projectName
42
-
43
- npm i
44
- ```
45
-
46
- ### 3. Start up
47
-
48
- ```
49
- npm run dev
50
-
51
- // or
52
- npm start
53
- ```
54
-
55
- ## Code style
56
-
57
- default Controller:
58
-
59
- ```javascript
60
- import { Controller, BaseController, Autowired, GetMapping, RequestBody, PathVariable,
61
- PostMapping, RequestMapping, RequestMethod, Valid } from "koatty";
62
- import { TestDTO } from "../model/dto/TestDTO";
63
- import { TestService } from "../service/TestService";
64
- import { App } from "../App";
65
-
66
- @Controller()
67
- export class IndexController extends BaseController {
68
- app: App;
69
-
70
- @Autowired()
71
- private testService: TestService;
72
-
73
- init() {
74
- this.cache = {};
75
- }
76
-
77
- @RequestMapping("/:name", RequestMethod.ALL)
78
- async default(@PathVariable("name") @Valid("IsNotEmpty") name: string) {
79
- try {
80
- const info = await this.testService.sayHello(name);
81
- return this.ok("success", info);
82
- } catch (err: Error) {
83
- return this.fail(err.message));
84
- }
85
- }
86
-
87
- @PostMapping("/test")
88
- @Validated() //need DTOClass
89
- test(@RequestParam() params: TestDTO) {
90
- return this.ok("test", params);
91
- }
92
- }
93
- ```
94
-
95
- ## How to do Unit Testing
96
-
97
- >only support `jest` UT framework now
98
-
99
- ```javascript
100
- import request from 'supertest';
101
- import { ExecBootStrap } from 'koatty';
102
- import { App } from '../src/App';
103
-
104
- describe('UT example', () => {
105
-
106
- let server: any;
107
- beforeAll(async () => {
108
- jest.useFakeTimers();
109
- const appInstance = await ExecBootStrap()(App);
110
- server = await appInstance.listen();
111
- });
112
-
113
- afterAll(done => {
114
- server.close();
115
- done();
116
- });
117
-
118
- it('request', async () => {
119
- const rsp = await request(server).get('/');
120
- expect(rsp.status).toBe(200);
121
- });
122
- });
123
-
124
- ```
125
-
126
- ## How to debug
127
-
128
- if you use vscode , edit the `.vscode/launch.json` , like this:
129
- ```
130
- {
131
- "version": "0.2.0",
132
- "configurations": [
133
- {
134
- "type": "node",
135
- "request": "launch",
136
- "name": "TS Program",
137
- "args": [
138
- "${workspaceRoot}/src/App.ts"
139
- ],
140
- "runtimeArgs": [
141
- "--nolazy",
142
- "-r",
143
- "ts-node/register"
144
- ],
145
- "sourceMaps": true,
146
- "cwd": "${workspaceRoot}",
147
- "protocol": "inspector",
148
- "internalConsoleOptions": "neverOpen"
149
- }
150
- ]
151
- }
152
- ```
153
- Select `TS Program` to debug run. Try to call `http://localhost:3000/` .
154
-
155
- ## Example
156
-
157
- Check out the [quick start example][quick-example].
158
-
159
- [quick-example]: https://github.com/thinkkoa/koatty_demo/
160
-
161
-
162
-
1
+ # koatty
2
+
3
+ Koa2 + Typescript + IOC = koatty.
4
+
5
+ Use Typescript's decorator implement IOC and AOP.
6
+
7
+ [![Version npm](https://img.shields.io/npm/v/koatty.svg?style=flat-square)](https://www.npmjs.com/package/koatty)[![npm Downloads](https://img.shields.io/npm/dm/koatty.svg?style=flat-square)](https://npmcharts.com/compare/koatty?minimal=true)
8
+
9
+ ## New features
10
+
11
+ * HTTP、HTTPS、HTTP2、gRPC、WebSocket server.
12
+ * Support loading environment configuration, parsing command line parameters (process.argv) and environment variables (process.env)
13
+ * `@ExceptionHandler()` Register global exception handling
14
+ * graceful shutdown and pre-exit event
15
+
16
+
17
+ ## Documentation
18
+
19
+ [koatty_doc_CN](https://koatty.org/) (In progress💪)
20
+
21
+
22
+ ## Installation CLI tools
23
+
24
+ ```shell
25
+ npm i -g koatty_cli
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ### 1.Create Project
31
+
32
+ ```shell
33
+ kt new projectName
34
+
35
+ npm start
36
+ ```
37
+
38
+ ### 2. Install deps
39
+
40
+ ```
41
+ cd ./projectName
42
+
43
+ npm i
44
+ ```
45
+
46
+ ### 3. Start up
47
+
48
+ ```
49
+ npm run dev
50
+
51
+ // or
52
+ npm start
53
+ ```
54
+
55
+ ## Code style
56
+
57
+ default Controller:
58
+
59
+ ```javascript
60
+ import { Controller, BaseController, Autowired, GetMapping, RequestBody, PathVariable,
61
+ PostMapping, RequestMapping, RequestMethod, Valid } from "koatty";
62
+ import { TestDTO } from "../model/dto/TestDTO";
63
+ import { TestService } from "../service/TestService";
64
+ import { App } from "../App";
65
+
66
+ @Controller()
67
+ export class IndexController extends BaseController {
68
+ app: App;
69
+
70
+ @Autowired()
71
+ private testService: TestService;
72
+
73
+ init() {
74
+ this.cache = {};
75
+ }
76
+
77
+ @RequestMapping("/:name", RequestMethod.ALL)
78
+ async default(@PathVariable("name") @Valid("IsNotEmpty") name: string) {
79
+ try {
80
+ const info = await this.testService.sayHello(name);
81
+ return this.ok("success", info);
82
+ } catch (err: Error) {
83
+ return this.fail(err.message));
84
+ }
85
+ }
86
+
87
+ @PostMapping("/test")
88
+ @Validated() //need DTOClass
89
+ test(@RequestParam() params: TestDTO) {
90
+ return this.ok("test", params);
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## How to do Unit Testing
96
+
97
+ >only support `jest` UT framework now
98
+
99
+ ```javascript
100
+ import request from 'supertest';
101
+ import { ExecBootStrap } from 'koatty';
102
+ import { App } from '../src/App';
103
+
104
+ describe('UT example', () => {
105
+
106
+ let server: any;
107
+ beforeAll(async () => {
108
+ jest.useFakeTimers();
109
+ const appInstance = await ExecBootStrap()(App);
110
+ server = await appInstance.listen();
111
+ });
112
+
113
+ afterAll(done => {
114
+ server.close();
115
+ done();
116
+ });
117
+
118
+ it('request', async () => {
119
+ const rsp = await request(server).get('/');
120
+ expect(rsp.status).toBe(200);
121
+ });
122
+ });
123
+
124
+ ```
125
+
126
+ ## How to debug
127
+
128
+ if you use vscode , edit the `.vscode/launch.json` , like this:
129
+ ```
130
+ {
131
+ "version": "0.2.0",
132
+ "configurations": [
133
+ {
134
+ "type": "node",
135
+ "request": "launch",
136
+ "name": "TS Program",
137
+ "args": [
138
+ "${workspaceRoot}/src/App.ts"
139
+ ],
140
+ "runtimeArgs": [
141
+ "--nolazy",
142
+ "-r",
143
+ "ts-node/register"
144
+ ],
145
+ "sourceMaps": true,
146
+ "cwd": "${workspaceRoot}",
147
+ "protocol": "inspector",
148
+ "internalConsoleOptions": "neverOpen"
149
+ }
150
+ ]
151
+ }
152
+ ```
153
+ Select `TS Program` to debug run. Try to call `http://localhost:3000/` .
154
+
155
+ ## Example
156
+
157
+ Check out the [quick start example][quick-example].
158
+
159
+ [quick-example]: https://github.com/thinkkoa/koatty_demo/
160
+
161
+
162
+
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-07-27 23:26:45
3
+ * @Date: 2023-08-21 16:06:04
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: 2023-07-27 23:26:32
3
+ * @Date: 2023-08-21 16:05:41
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -151,13 +151,13 @@ const COMPONENT_SCAN = 'COMPONENT_SCAN';
151
151
  const CONFIGURATION_SCAN = 'CONFIGURATION_SCAN';
152
152
  const APP_BOOT_HOOK = "APP_BOOT_HOOK";
153
153
  // tslint:disable: no-irregular-whitespace
154
- const LOGO = `
155
-
156
- ┬┌─┌─┐┌─┐┌┬┐┌┬┐┬ ┬
157
- ├┴┐│ │├─┤ │ │ └┬┘
158
- ┴ ┴└─┘┴ ┴ ┴ ┴ ┴
159
- -------------------------------------------
160
- https://github.com/koatty
154
+ const LOGO = `
155
+
156
+ ┬┌─┌─┐┌─┐┌┬┐┌┬┐┬ ┬
157
+ ├┴┐│ │├─┤ │ │ └┬┘
158
+ ┴ ┴└─┘┴ ┴ ┴ ┴ ┴
159
+ -------------------------------------------
160
+ https://github.com/koatty
161
161
  `;
162
162
 
163
163
  /**
@@ -613,7 +613,7 @@ class Loader {
613
613
  }
614
614
  }
615
615
 
616
- var version = "3.9.1-3";
616
+ var version = "3.9.2";
617
617
  var engines = {
618
618
  node: ">12.0.0"
619
619
  };
@@ -816,7 +816,7 @@ function Bootstrap(bootFunc) {
816
816
  function ExecBootStrap(bootFunc) {
817
817
  return async (target) => {
818
818
  if (!(target.prototype instanceof koatty_core.Koatty)) {
819
- throw new Error(`class ${target.name} does not inherit from TKoatty`);
819
+ throw new Error(`class ${target.name} does not inherit from Koatty`);
820
820
  }
821
821
  return await executeBootstrap(target, bootFunc, true);
822
822
  };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2023-07-27 23:26:32
3
+ * @Date: 2023-08-21 16:05:41
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
@@ -136,13 +136,13 @@ const COMPONENT_SCAN = 'COMPONENT_SCAN';
136
136
  const CONFIGURATION_SCAN = 'CONFIGURATION_SCAN';
137
137
  const APP_BOOT_HOOK = "APP_BOOT_HOOK";
138
138
  // tslint:disable: no-irregular-whitespace
139
- const LOGO = `
140
-
141
- ┬┌─┌─┐┌─┐┌┬┐┌┬┐┬ ┬
142
- ├┴┐│ │├─┤ │ │ └┬┘
143
- ┴ ┴└─┘┴ ┴ ┴ ┴ ┴
144
- -------------------------------------------
145
- https://github.com/koatty
139
+ const LOGO = `
140
+
141
+ ┬┌─┌─┐┌─┐┌┬┐┌┬┐┬ ┬
142
+ ├┴┐│ │├─┤ │ │ └┬┘
143
+ ┴ ┴└─┘┴ ┴ ┴ ┴ ┴
144
+ -------------------------------------------
145
+ https://github.com/koatty
146
146
  `;
147
147
 
148
148
  /**
@@ -598,7 +598,7 @@ class Loader {
598
598
  }
599
599
  }
600
600
 
601
- var version = "3.9.1-3";
601
+ var version = "3.9.2";
602
602
  var engines = {
603
603
  node: ">12.0.0"
604
604
  };
@@ -801,7 +801,7 @@ function Bootstrap(bootFunc) {
801
801
  function ExecBootStrap(bootFunc) {
802
802
  return async (target) => {
803
803
  if (!(target.prototype instanceof Koatty)) {
804
- throw new Error(`class ${target.name} does not inherit from TKoatty`);
804
+ throw new Error(`class ${target.name} does not inherit from Koatty`);
805
805
  }
806
806
  return await executeBootstrap(target, bootFunc, true);
807
807
  };
package/dist/package.json CHANGED
@@ -1,95 +1,94 @@
1
- {
2
- "name": "koatty",
3
- "version": "3.9.1-3",
4
- "description": "Koa2 + Typescript = koatty. Use Typescript's decorator implement auto injection.",
5
- "scripts": {
6
- "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
7
- "build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
8
- "build:js": "del-cli --force dist && npx rollup --bundleConfigAsCjs -c .rollup.config.js",
9
- "build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
10
- "build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
11
- "eslint": "eslint --ext .ts,.js ./",
12
- "prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
13
- "prerelease": "npm test && npm run build",
14
- "release": "standard-version",
15
- "release:pre": "npm run release -- --prerelease",
16
- "release:major": "npm run release -- --release-as major",
17
- "release:minor": "npm run release -- --release-as minor",
18
- "test": "npm run eslint && jest --passWithNoTests",
19
- "test:cov": "jest --collectCoverage --detectOpenHandles",
20
- "version": "conventional-changelog -p angular -i CHANGELOG.md -s"
21
- },
22
- "main": "./dist/index.js",
23
- "exports": {
24
- "require": "./dist/index.js",
25
- "import": "./dist/index.mjs"
26
- },
27
- "directories": {
28
- "doc": "docs"
29
- },
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/thinkkoa/koatty.git"
33
- },
34
- "engines": {
35
- "node": ">12.0.0"
36
- },
37
- "author": {
38
- "name": "richenlin",
39
- "email": "richenlin@gmail.com"
40
- },
41
- "license": "BSD-3-Clause",
42
- "bugs": {
43
- "url": "https://github.com/thinkkoa/koatty/issues"
44
- },
45
- "homepage": "https://github.com/thinkkoa/koatty",
46
- "maintainers": [
47
- {
48
- "name": "richenlin",
49
- "email": "richenlin@gmail.com"
50
- }
51
- ],
52
- "devDependencies": {
53
- "@commitlint/cli": "^17.x.x",
54
- "@commitlint/config-conventional": "^17.x.x",
55
- "@microsoft/api-documenter": "^7.x.x",
56
- "@microsoft/api-extractor": "^7.x.x",
57
- "@rollup/plugin-json": "^6.x.x",
58
- "@types/jest": "^29.x.x",
59
- "@types/koa": "^2.x.x",
60
- "@types/koa__router": "^12.x.x",
61
- "@types/node": "^18.x.x",
62
- "@types/ws": "^8.x.x",
63
- "@typescript-eslint/eslint-plugin": "^5.x.x",
64
- "@typescript-eslint/parser": "^5.x.x",
65
- "conventional-changelog-cli": "^2.x.x",
66
- "copyfiles": "^2.x.x",
67
- "del-cli": "^4.x.x",
68
- "eslint": "^8.x.x",
69
- "eslint-plugin-jest": "^27.x.x",
70
- "husky": "^4.x.x",
71
- "jest": "^29.x.x",
72
- "jest-html-reporters": "^3.x.x",
73
- "rollup": "^3.x.x",
74
- "rollup-plugin-typescript2": "^0.x.x",
75
- "standard-version": "^9.x.x",
76
- "ts-jest": "^29.x.x",
77
- "ts-node": "^10.x.x",
78
- "typescript": "^4.x.x"
79
- },
80
- "dependencies": {
81
- "koa": "^2.14.2",
82
- "koatty_config": "^1.1.6",
83
- "koatty_container": "^1.8.1",
84
- "koatty_core": "^1.7.8",
85
- "koatty_exception": "^1.2.8",
86
- "koatty_lib": "^1.3.3",
87
- "koatty_loader": "^1.1.0",
88
- "koatty_logger": "^2.1.1",
89
- "koatty_payload": "^1.4.5",
90
- "koatty_proto": "^1.1.12",
91
- "koatty_serve": "^2.0.4",
92
- "koatty_trace": "^1.9.1",
93
- "koatty_validation": "^1.2.8"
94
- }
95
- }
1
+ {
2
+ "name": "koatty",
3
+ "version": "3.9.2",
4
+ "description": "Koa2 + Typescript = koatty. Use Typescript's decorator implement auto injection.",
5
+ "scripts": {
6
+ "build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
7
+ "build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
8
+ "build:js": "del-cli --force dist && npx rollup --bundleConfigAsCjs -c .rollup.config.js",
9
+ "build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
10
+ "build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
11
+ "eslint": "eslint --ext .ts,.js ./",
12
+ "prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
13
+ "prerelease": "npm test && npm run build",
14
+ "release": "standard-version",
15
+ "release:pre": "npm run release -- --prerelease",
16
+ "release:major": "npm run release -- --release-as major",
17
+ "release:minor": "npm run release -- --release-as minor",
18
+ "test": "npm run eslint && jest --passWithNoTests",
19
+ "test:cov": "jest --collectCoverage --detectOpenHandles",
20
+ "version": "conventional-changelog -p angular -i CHANGELOG.md -s"
21
+ },
22
+ "main": "./dist/index.js",
23
+ "exports": {
24
+ "require": "./dist/index.js",
25
+ "import": "./dist/index.mjs"
26
+ },
27
+ "directories": {
28
+ "doc": "docs"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/thinkkoa/koatty.git"
33
+ },
34
+ "engines": {
35
+ "node": ">12.0.0"
36
+ },
37
+ "author": {
38
+ "name": "richenlin",
39
+ "email": "richenlin@gmail.com"
40
+ },
41
+ "license": "BSD-3-Clause",
42
+ "bugs": {
43
+ "url": "https://github.com/thinkkoa/koatty/issues"
44
+ },
45
+ "homepage": "https://github.com/thinkkoa/koatty",
46
+ "maintainers": [
47
+ {
48
+ "name": "richenlin",
49
+ "email": "richenlin@gmail.com"
50
+ }
51
+ ],
52
+ "devDependencies": {
53
+ "@commitlint/cli": "^17.x.x",
54
+ "@commitlint/config-conventional": "^17.x.x",
55
+ "@microsoft/api-documenter": "^7.x.x",
56
+ "@microsoft/api-extractor": "^7.x.x",
57
+ "@rollup/plugin-json": "^6.x.x",
58
+ "@types/jest": "^29.x.x",
59
+ "@types/koa": "^2.x.x",
60
+ "@types/koa__router": "^12.x.x",
61
+ "@types/node": "^18.x.x",
62
+ "@types/ws": "^8.x.x",
63
+ "@typescript-eslint/eslint-plugin": "^5.x.x",
64
+ "@typescript-eslint/parser": "^5.x.x",
65
+ "conventional-changelog-cli": "^2.x.x",
66
+ "copyfiles": "^2.x.x",
67
+ "del-cli": "^4.x.x",
68
+ "eslint": "^8.x.x",
69
+ "eslint-plugin-jest": "^27.x.x",
70
+ "husky": "^4.x.x",
71
+ "jest": "^29.x.x",
72
+ "jest-html-reporters": "^3.x.x",
73
+ "rollup": "^3.x.x",
74
+ "rollup-plugin-typescript2": "^0.x.x",
75
+ "standard-version": "^9.x.x",
76
+ "ts-jest": "^29.x.x",
77
+ "ts-node": "^10.x.x",
78
+ "typescript": "^4.x.x"
79
+ },
80
+ "dependencies": {
81
+ "koa": "^2.14.2",
82
+ "koatty_config": "^1.1.6",
83
+ "koatty_container": "^1.8.1",
84
+ "koatty_core": "^1.7.8",
85
+ "koatty_lib": "^1.3.4",
86
+ "koatty_loader": "^1.1.0",
87
+ "koatty_logger": "^2.1.1",
88
+ "koatty_payload": "^1.4.5",
89
+ "koatty_proto": "^1.1.12",
90
+ "koatty_serve": "^2.0.4",
91
+ "koatty_trace": "^1.9.3",
92
+ "koatty_validation": "^1.2.8"
93
+ }
94
+ }