koatty 3.5.9 → 3.5.12-1

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 (129) hide show
  1. package/.commitlintrc.js +3 -0
  2. package/.eslintignore +2 -0
  3. package/.huskyrc +5 -0
  4. package/.versionrc.js +16 -0
  5. package/CHANGELOG.md +2 -37
  6. package/README.md +5 -9
  7. package/api-extractor.json +345 -0
  8. package/dist/LICENSE +29 -0
  9. package/dist/README.md +147 -0
  10. package/dist/index.d.ts +363 -19
  11. package/dist/index.js +1266 -26
  12. package/dist/index.mjs +1197 -0
  13. package/dist/package.json +98 -0
  14. package/docs/api/index.md +12 -0
  15. package/docs/api/koatty.apiinput.code.md +11 -0
  16. package/docs/api/koatty.apiinput.data.md +11 -0
  17. package/docs/api/koatty.apiinput.md +22 -0
  18. package/docs/api/koatty.apiinput.message.md +11 -0
  19. package/docs/api/koatty.apioutput.code.md +11 -0
  20. package/docs/api/koatty.apioutput.data.md +11 -0
  21. package/docs/api/koatty.apioutput.md +22 -0
  22. package/docs/api/koatty.apioutput.message.md +11 -0
  23. package/docs/api/koatty.appreadyhookfunc.md +11 -0
  24. package/docs/api/koatty.basecontroller._constructor_.md +20 -0
  25. package/docs/api/koatty.basecontroller._options.md +11 -0
  26. package/docs/api/koatty.basecontroller.app.md +11 -0
  27. package/docs/api/koatty.basecontroller.ctx.md +11 -0
  28. package/docs/api/koatty.basecontroller.fail.md +28 -0
  29. package/docs/api/koatty.basecontroller.init.md +19 -0
  30. package/docs/api/koatty.basecontroller.md +39 -0
  31. package/docs/api/koatty.basecontroller.ok.md +28 -0
  32. package/docs/api/koatty.baseservice._constructor_.md +20 -0
  33. package/docs/api/koatty.baseservice._options.md +11 -0
  34. package/docs/api/koatty.baseservice.app.md +11 -0
  35. package/docs/api/koatty.baseservice.init.md +25 -0
  36. package/docs/api/koatty.baseservice.md +36 -0
  37. package/docs/api/koatty.bindappreadyhook.md +26 -0
  38. package/docs/api/koatty.bootstrap.md +27 -0
  39. package/docs/api/koatty.component.md +27 -0
  40. package/docs/api/koatty.componentscan.md +27 -0
  41. package/docs/api/koatty.configurationscan.md +27 -0
  42. package/docs/api/koatty.controller.md +27 -0
  43. package/docs/api/koatty.httpcontroller.body.md +28 -0
  44. package/docs/api/koatty.httpcontroller.deny.md +26 -0
  45. package/docs/api/koatty.httpcontroller.expires.md +26 -0
  46. package/docs/api/koatty.httpcontroller.fail.md +28 -0
  47. package/docs/api/koatty.httpcontroller.header.md +27 -0
  48. package/docs/api/koatty.httpcontroller.isget.md +19 -0
  49. package/docs/api/koatty.httpcontroller.ismethod.md +26 -0
  50. package/docs/api/koatty.httpcontroller.ispost.md +19 -0
  51. package/docs/api/koatty.httpcontroller.json.md +26 -0
  52. package/docs/api/koatty.httpcontroller.md +35 -0
  53. package/docs/api/koatty.httpcontroller.ok.md +28 -0
  54. package/docs/api/koatty.httpcontroller.param.md +26 -0
  55. package/docs/api/koatty.httpcontroller.redirect.md +27 -0
  56. package/docs/api/koatty.httpcontroller.type.md +27 -0
  57. package/docs/api/koatty.icontroller.__after.md +11 -0
  58. package/docs/api/koatty.icontroller.__befor.md +11 -0
  59. package/docs/api/koatty.icontroller.app.md +11 -0
  60. package/docs/api/koatty.icontroller.ctx.md +11 -0
  61. package/docs/api/koatty.icontroller.fail.md +11 -0
  62. package/docs/api/koatty.icontroller.md +25 -0
  63. package/docs/api/koatty.icontroller.ok.md +11 -0
  64. package/docs/api/koatty.imiddleware.md +20 -0
  65. package/docs/api/koatty.imiddleware.run.md +11 -0
  66. package/docs/api/koatty.iplugin.md +20 -0
  67. package/docs/api/koatty.iplugin.run.md +11 -0
  68. package/docs/api/koatty.iservice.app.md +11 -0
  69. package/docs/api/koatty.iservice.md +20 -0
  70. package/docs/api/koatty.logger.md +11 -0
  71. package/docs/api/koatty.md +51 -0
  72. package/docs/api/koatty.middleware.md +27 -0
  73. package/docs/api/koatty.plugin.md +27 -0
  74. package/docs/api/koatty.service.md +27 -0
  75. package/jest.config.js +0 -2
  76. package/jest_html_reporters.html +1 -1
  77. package/package.json +39 -39
  78. package/rollup.config.js +63 -0
  79. package/scripts/copyright.js +28 -0
  80. package/scripts/postBuild.js +10 -0
  81. package/tsconfig.json +4 -2
  82. package/babel.config.js +0 -21
  83. package/commitlint.config.js +0 -14
  84. package/dist/config/config.d.ts +0 -18
  85. package/dist/config/config.js +0 -25
  86. package/dist/config/config.js.map +0 -1
  87. package/dist/config/middleware.d.ts +0 -23
  88. package/dist/config/middleware.js +0 -34
  89. package/dist/config/middleware.js.map +0 -1
  90. package/dist/config/plugin.d.ts +0 -11
  91. package/dist/config/plugin.js +0 -15
  92. package/dist/config/plugin.js.map +0 -1
  93. package/dist/config/router.d.ts +0 -8
  94. package/dist/config/router.js +0 -32
  95. package/dist/config/router.js.map +0 -1
  96. package/dist/controller/BaseController.d.ts +0 -60
  97. package/dist/controller/BaseController.js +0 -137
  98. package/dist/controller/BaseController.js.map +0 -1
  99. package/dist/controller/HttpController.d.ts +0 -131
  100. package/dist/controller/HttpController.js +0 -215
  101. package/dist/controller/HttpController.js.map +0 -1
  102. package/dist/core/Bootstrap.d.ts +0 -50
  103. package/dist/core/Bootstrap.js +0 -215
  104. package/dist/core/Bootstrap.js.map +0 -1
  105. package/dist/core/Component.d.ts +0 -94
  106. package/dist/core/Component.js +0 -89
  107. package/dist/core/Component.js.map +0 -1
  108. package/dist/core/Constants.d.ts +0 -11
  109. package/dist/core/Constants.js +0 -24
  110. package/dist/core/Constants.js.map +0 -1
  111. package/dist/core/Loader.d.ts +0 -110
  112. package/dist/core/Loader.js +0 -407
  113. package/dist/core/Loader.js.map +0 -1
  114. package/dist/index.js.map +0 -1
  115. package/dist/middleware/PayloadMiddleware.d.ts +0 -11
  116. package/dist/middleware/PayloadMiddleware.js +0 -22
  117. package/dist/middleware/PayloadMiddleware.js.map +0 -1
  118. package/dist/middleware/TraceMiddleware.d.ts +0 -11
  119. package/dist/middleware/TraceMiddleware.js +0 -22
  120. package/dist/middleware/TraceMiddleware.js.map +0 -1
  121. package/dist/service/BaseService.d.ts +0 -33
  122. package/dist/service/BaseService.js +0 -32
  123. package/dist/service/BaseService.js.map +0 -1
  124. package/dist/util/Helper.d.ts +0 -25
  125. package/dist/util/Helper.js +0 -117
  126. package/dist/util/Helper.js.map +0 -1
  127. package/dist/util/Logger.d.ts +0 -27
  128. package/dist/util/Logger.js +0 -41
  129. package/dist/util/Logger.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ["gitmoji"],
3
+ };
package/.eslintignore CHANGED
@@ -4,6 +4,8 @@ node_modules
4
4
  **/yarn.lock
5
5
  **/*.config.js
6
6
  dist
7
+ temp
8
+ scripts
7
9
  coverage
8
10
  test
9
11
  demo
package/.huskyrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "hooks": {
3
+ "commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
4
+ }
5
+ }
package/.versionrc.js ADDED
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ // skip: {
3
+ // tag: true,
4
+ // },
5
+ //server-version自动commit的模板
6
+ releaseCommitMessageFormat:
7
+ "🔧 build: v{{currentTag}}",
8
+ //需要server-version更新版本号的文件
9
+ bumpFiles: [
10
+ {
11
+ filename: "package.json",
12
+ // The `json` updater assumes the version is available under a `version` key in the provided JSON document.
13
+ type: "json",
14
+ },
15
+ ],
16
+ };
package/CHANGELOG.md CHANGED
@@ -2,41 +2,6 @@
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
- ### [3.5.2](https://github.com/thinkkoa/koatty/compare/v3.4.12...v3.5.2) (2021-12-01)
5
+ ### [3.5.12-1](https://github.com/thinkkoa/koatty/compare/v3.5.12-0...v3.5.12-1) (2021-12-21)
6
6
 
7
- ### [3.4.12](https://github.com/thinkkoa/koatty/compare/v3.4.8...v3.4.12) (2021-11-26)
8
-
9
- ### [3.4.8](https://github.com/thinkkoa/koatty/compare/v3.4.4...v3.4.8) (2021-11-25)
10
-
11
- ### [3.4.6](https://github.com/thinkkoa/koatty/compare/v3.4.4...v3.4.6) (2021-11-25)
12
-
13
- ### [3.4.4](https://github.com/thinkkoa/koatty/compare/v3.4.2...v3.4.4) (2021-11-20)
14
-
15
- ### [3.4.2](https://github.com/thinkkoa/koatty/compare/v3.3.6...v3.4.2) (2021-11-19)
16
-
17
- ### [3.3.6](https://github.com/thinkkoa/koatty/compare/v3.2.12...v3.3.6) (2021-07-13)
18
-
19
- ### [3.3.4](https://github.com/thinkkoa/koatty/compare/v3.3.3...v3.3.4) (2021-07-07)
20
-
21
- ### [3.3.3](https://github.com/thinkkoa/koatty/compare/v3.3.2...v3.3.3) (2021-07-06)
22
-
23
- ### [3.3.2](https://github.com/thinkkoa/koatty/compare/v3.3.0...v3.3.2) (2021-07-01)
24
-
25
- ### [3.3.0](https://github.com/thinkkoa/koatty/compare/v3.2.12...v3.3.0) (2021-06-24)
26
- ### [3.2.12](https://github.com/thinkkoa/koatty/compare/v3.2.11...v3.2.12) (2021-06-24)
27
-
28
- ### [3.2.11](https://github.com/thinkkoa/koatty/compare/v3.2.10...v3.2.11) (2021-06-24)
29
-
30
- ### [3.2.10](https://github.com/thinkkoa/koatty/compare/v3.2.8...v3.2.10) (2021-06-23)
31
-
32
-
33
- ### Bug Fixes
34
-
35
- * eslint ([2297a9d](https://github.com/thinkkoa/koatty/commit/2297a9dc054e911f31dbe5d8802d982077316df7))
36
-
37
- ### 3.2.8 (2021-06-21)
38
-
39
-
40
- ### Bug Fixes
41
-
42
- * --story=[#4](https://github.com/thinkkoa/koatty/issues/4) [bug] RequestMapping内的装饰器用法范围模糊 ([93f7abd](https://github.com/thinkkoa/koatty/commit/93f7abd776bc14449e762c163a1194c6608e1cd3))
7
+ ### [3.5.12-0](https://github.com/thinkkoa/koatty/compare/v3.5.10...v3.5.12-0) (2021-12-21)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # koatty
2
2
 
3
- Koa2 + Typescript = koatty.
3
+ Koa2 + Typescript + IOC = koatty.
4
4
 
5
5
  Use Typescript's decorator implement IOC and AOP.
6
6
 
@@ -11,13 +11,13 @@ Use Typescript's decorator implement IOC and AOP.
11
11
  * HTTP、HTTPS、HTTP2 .
12
12
  * gRPC server.
13
13
  * WebSocket server. (unstable)
14
+ * Support loading environment configuration, support parsing command line parameters (process. argv) and environment variables (process.env)
14
15
 
15
16
 
16
17
  ## Documentation
17
18
 
18
- [koatty_doc_CN](https://koatty.github.io/koatty_doc/) (In progress💪)
19
+ [koatty_doc_CN](https://koatty.org/) (In progress💪)
19
20
 
20
- [koatty_doc_EN] come soon...
21
21
 
22
22
  ## Installation
23
23
 
@@ -60,14 +60,11 @@ koatty middleware test
60
60
  ```
61
61
  ### 4.Create a Model(Optional)
62
62
 
63
- Supports [thinkorm](https://github.com/thinkkoa/thinkorm) and [typeorm](https://github.com/typeorm/typeorm). Please expand other ORM by yourself.
63
+ Supports [typeorm](https://github.com/typeorm/typeorm). Please expand other ORM by yourself.
64
64
 
65
65
  ```shell
66
- //thinkorm
67
- koatty middleware test
68
-
69
66
  //typeorm
70
- koatty middleware -o typeorm test
67
+ koatty middleware test
71
68
 
72
69
  ```
73
70
 
@@ -148,4 +145,3 @@ Check out the [quick start example][quick-example].
148
145
 
149
146
 
150
147
 
151
-
@@ -0,0 +1,345 @@
1
+ /**
2
+ * Config file for API Extractor. For more info, please visit: https://api-extractor.com
3
+ */
4
+ {
5
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
6
+ /**
7
+ * Optionally specifies another JSON config file that this file extends from. This provides a way for
8
+ * standard settings to be shared across multiple projects.
9
+ *
10
+ * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
11
+ * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
12
+ * resolved using NodeJS require().
13
+ *
14
+ * SUPPORTED TOKENS: none
15
+ * DEFAULT VALUE: ""
16
+ */
17
+ // "extends": "./shared/api-extractor-base.json"
18
+ // "extends": "my-package/include/api-extractor-base.json"
19
+ /**
20
+ * Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
21
+ * typically contains the tsconfig.json and package.json config files, but the path is user-defined.
22
+ *
23
+ * The path is resolved relative to the folder of the config file that contains the setting.
24
+ *
25
+ * The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
26
+ * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
27
+ * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
28
+ * will be reported.
29
+ *
30
+ * SUPPORTED TOKENS: <lookup>
31
+ * DEFAULT VALUE: "<lookup>"
32
+ */
33
+ // "projectFolder": "..",
34
+ /**
35
+ * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
36
+ * analyzes the symbols exported by this module.
37
+ *
38
+ * The file extension must be ".d.ts" and not ".ts".
39
+ *
40
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
41
+ * prepend a folder token such as "<projectFolder>".
42
+ *
43
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
44
+ */
45
+ "mainEntryPointFilePath": "<projectFolder>/temp/src/index.d.ts",
46
+ /**
47
+ * A list of NPM package names whose exports should be treated as part of this package.
48
+ *
49
+ * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
50
+ * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
51
+ * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
52
+ * imports library2. To avoid this, we can specify:
53
+ *
54
+ * "bundledPackages": [ "library2" ],
55
+ *
56
+ * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
57
+ * local files for library1.
58
+ */
59
+ "bundledPackages": [],
60
+ /**
61
+ * Determines how the TypeScript compiler engine will be invoked by API Extractor.
62
+ */
63
+ "compiler": {
64
+ /**
65
+ * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
66
+ *
67
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
68
+ * prepend a folder token such as "<projectFolder>".
69
+ *
70
+ * Note: This setting will be ignored if "overrideTsconfig" is used.
71
+ *
72
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
73
+ * DEFAULT VALUE: "<projectFolder>/tsconfig.json"
74
+ */
75
+ // "tsconfigFilePath": "<projectFolder>/tsconfig.json",
76
+ /**
77
+ * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
78
+ * The object must conform to the TypeScript tsconfig schema:
79
+ *
80
+ * http://json.schemastore.org/tsconfig
81
+ *
82
+ * If omitted, then the tsconfig.json file will be read from the "projectFolder".
83
+ *
84
+ * DEFAULT VALUE: no overrideTsconfig section
85
+ */
86
+ // "overrideTsconfig": {
87
+ // . . .
88
+ // }
89
+ /**
90
+ * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
91
+ * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
92
+ * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
93
+ * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
94
+ *
95
+ * DEFAULT VALUE: false
96
+ */
97
+ // "skipLibCheck": true,
98
+ },
99
+ /**
100
+ * Configures how the API report file (*.api.md) will be generated.
101
+ */
102
+ "apiReport": {
103
+ /**
104
+ * (REQUIRED) Whether to generate an API report.
105
+ */
106
+ "enabled": false
107
+ /**
108
+ * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
109
+ * a full file path.
110
+ *
111
+ * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
112
+ *
113
+ * SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
114
+ * DEFAULT VALUE: "<unscopedPackageName>.api.md"
115
+ */
116
+ // "reportFileName": "<unscopedPackageName>.api.md",
117
+ /**
118
+ * Specifies the folder where the API report file is written. The file name portion is determined by
119
+ * the "reportFileName" setting.
120
+ *
121
+ * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
122
+ * e.g. for an API review.
123
+ *
124
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
125
+ * prepend a folder token such as "<projectFolder>".
126
+ *
127
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
128
+ * DEFAULT VALUE: "<projectFolder>/etc/"
129
+ */
130
+ // "reportFolder": "<projectFolder>/etc/",
131
+ /**
132
+ * Specifies the folder where the temporary report file is written. The file name portion is determined by
133
+ * the "reportFileName" setting.
134
+ *
135
+ * After the temporary file is written to disk, it is compared with the file in the "reportFolder".
136
+ * If they are different, a production build will fail.
137
+ *
138
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
139
+ * prepend a folder token such as "<projectFolder>".
140
+ *
141
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
142
+ * DEFAULT VALUE: "<projectFolder>/temp/"
143
+ */
144
+ // "reportTempFolder": "<projectFolder>/temp/"
145
+ },
146
+ /**
147
+ * Configures how the doc model file (*.api.json) will be generated.
148
+ */
149
+ "docModel": {
150
+ /**
151
+ * (REQUIRED) Whether to generate a doc model file.
152
+ */
153
+ "enabled": true
154
+ /**
155
+ * The output path for the doc model file. The file extension should be ".api.json".
156
+ *
157
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
158
+ * prepend a folder token such as "<projectFolder>".
159
+ *
160
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
161
+ * DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
162
+ */
163
+ // "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
164
+ },
165
+ /**
166
+ * Configures how the .d.ts rollup file will be generated.
167
+ */
168
+ "dtsRollup": {
169
+ /**
170
+ * (REQUIRED) Whether to generate the .d.ts rollup file.
171
+ */
172
+ "enabled": true,
173
+ /**
174
+ * Specifies the output path for a .d.ts rollup file to be generated without any trimming.
175
+ * This file will include all declarations that are exported by the main entry point.
176
+ *
177
+ * If the path is an empty string, then this file will not be written.
178
+ *
179
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
180
+ * prepend a folder token such as "<projectFolder>".
181
+ *
182
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
183
+ * DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
184
+ */
185
+ "untrimmedFilePath": "",
186
+ /**
187
+ * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
188
+ * This file will include only declarations that are marked as "@public" or "@beta".
189
+ *
190
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
191
+ * prepend a folder token such as "<projectFolder>".
192
+ *
193
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
194
+ * DEFAULT VALUE: ""
195
+ */
196
+ // "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
197
+ /**
198
+ * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
199
+ * This file will include only declarations that are marked as "@public".
200
+ *
201
+ * If the path is an empty string, then this file will not be written.
202
+ *
203
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
204
+ * prepend a folder token such as "<projectFolder>".
205
+ *
206
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
207
+ * DEFAULT VALUE: ""
208
+ */
209
+ "publicTrimmedFilePath": "<projectFolder>/dist/index.d.ts",
210
+ /**
211
+ * When a declaration is trimmed, by default it will be replaced by a code comment such as
212
+ * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
213
+ * declaration completely.
214
+ *
215
+ * DEFAULT VALUE: false
216
+ */
217
+ "omitTrimmingComments": true
218
+ },
219
+ /**
220
+ * Configures how the tsdoc-metadata.json file will be generated.
221
+ */
222
+ "tsdocMetadata": {
223
+ /**
224
+ * Whether to generate the tsdoc-metadata.json file.
225
+ *
226
+ * DEFAULT VALUE: true
227
+ */
228
+ "enabled": false
229
+ /**
230
+ * Specifies where the TSDoc metadata file should be written.
231
+ *
232
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
233
+ * prepend a folder token such as "<projectFolder>".
234
+ *
235
+ * The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
236
+ * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
237
+ * falls back to "tsdoc-metadata.json" in the package folder.
238
+ *
239
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
240
+ * DEFAULT VALUE: "<lookup>"
241
+ */
242
+ // "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
243
+ },
244
+ /**
245
+ * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
246
+ * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
247
+ * To use the OS's default newline kind, specify "os".
248
+ *
249
+ * DEFAULT VALUE: "crlf"
250
+ */
251
+ // "newlineKind": "crlf",
252
+ /**
253
+ * Configures how API Extractor reports error and warning messages produced during analysis.
254
+ *
255
+ * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
256
+ */
257
+ "messages": {
258
+ /**
259
+ * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
260
+ * the input .d.ts files.
261
+ *
262
+ * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
263
+ *
264
+ * DEFAULT VALUE: A single "default" entry with logLevel=warning.
265
+ */
266
+ "compilerMessageReporting": {
267
+ /**
268
+ * Configures the default routing for messages that don't match an explicit rule in this table.
269
+ */
270
+ "default": {
271
+ /**
272
+ * Specifies whether the message should be written to the the tool's output log. Note that
273
+ * the "addToApiReportFile" property may supersede this option.
274
+ *
275
+ * Possible values: "error", "warning", "none"
276
+ *
277
+ * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
278
+ * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
279
+ * the "--local" option), the warning is displayed but the build will not fail.
280
+ *
281
+ * DEFAULT VALUE: "warning"
282
+ */
283
+ "logLevel": "warning"
284
+ /**
285
+ * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
286
+ * then the message will be written inside that file; otherwise, the message is instead logged according to
287
+ * the "logLevel" option.
288
+ *
289
+ * DEFAULT VALUE: false
290
+ */
291
+ // "addToApiReportFile": false
292
+ }
293
+ // "TS2551": {
294
+ // "logLevel": "warning",
295
+ // "addToApiReportFile": true
296
+ // },
297
+ //
298
+ // . . .
299
+ },
300
+ /**
301
+ * Configures handling of messages reported by API Extractor during its analysis.
302
+ *
303
+ * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
304
+ *
305
+ * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
306
+ */
307
+ "extractorMessageReporting": {
308
+ "default": {
309
+ "logLevel": "warning"
310
+ // "addToApiReportFile": false
311
+ },
312
+ "ae-missing-release-tag": {
313
+ "logLevel": "none"
314
+ }
315
+ // "ae-extra-release-tag": {
316
+ // "logLevel": "warning",
317
+ // "addToApiReportFile": true
318
+ // },
319
+ //
320
+ // . . .
321
+ },
322
+ /**
323
+ * Configures handling of messages reported by the TSDoc parser when analyzing code comments.
324
+ *
325
+ * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
326
+ *
327
+ * DEFAULT VALUE: A single "default" entry with logLevel=warning.
328
+ */
329
+ "tsdocMessageReporting": {
330
+ "default": {
331
+ "logLevel": "warning"
332
+ // "addToApiReportFile": false
333
+ },
334
+ "tsdoc-param-tag-missing-hyphen": {
335
+ "logLevel": "none"
336
+ }
337
+ // "tsdoc-link-tag-unescaped-text": {
338
+ // "logLevel": "warning",
339
+ // "addToApiReportFile": true
340
+ // },
341
+ //
342
+ // . . .
343
+ }
344
+ }
345
+ }
package/dist/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2020, Koatty
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/dist/README.md ADDED
@@ -0,0 +1,147 @@
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 .
12
+ * gRPC server.
13
+ * WebSocket server. (unstable)
14
+ * Support loading environment configuration, support parsing command line parameters (process. argv) and environment variables (process.env)
15
+
16
+
17
+ ## Documentation
18
+
19
+ [koatty_doc_CN](https://koatty.org/) (In progress💪)
20
+
21
+
22
+ ## Installation
23
+
24
+ ```shell
25
+ npm i -g koatty_cli
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ### 1.Create Project
31
+
32
+ ```shell
33
+ koatty new projectName
34
+
35
+ cd ./projectName
36
+
37
+ yarn install
38
+
39
+ npm start
40
+ ```
41
+
42
+ ### 2.Create a Controller
43
+ ```shell
44
+ koatty controller test
45
+
46
+ ```
47
+
48
+ ### 3.Create a Service
49
+
50
+ ```shell
51
+ koatty service test
52
+
53
+ ```
54
+
55
+ ### 3.Create a Middleware (Optional)
56
+
57
+ ```shell
58
+ koatty middleware test
59
+
60
+ ```
61
+ ### 4.Create a Model(Optional)
62
+
63
+ Supports [typeorm](https://github.com/typeorm/typeorm). Please expand other ORM by yourself.
64
+
65
+ ```shell
66
+ //typeorm
67
+ koatty middleware test
68
+
69
+ ```
70
+
71
+ ### 5.Create a DTOClass (Optional)
72
+
73
+ ```shell
74
+ koatty dto test
75
+
76
+ ```
77
+
78
+ ### 6.Define TestController
79
+
80
+ ```javascript
81
+ import { Controller, BaseController, Autowired, GetMapping, RequestBody, PathVariable, PostMapping, RequestMapping, RequestMethod, Valid } from "koatty";
82
+ import { TestDTO } from "../model/dto/TestDTO";
83
+ import { TestService } from "../service/TestService";
84
+ import { App } from "../App";
85
+
86
+ @Controller()
87
+ export class IndexController extends BaseController {
88
+ app: App;
89
+
90
+ @Autowired()
91
+ private testService: TestService;
92
+
93
+ init() {
94
+ this.cache = {};
95
+ }
96
+
97
+ @RequestMapping("/:name", RequestMethod.ALL)
98
+ async default(@PathVariable("name") @Valid("IsNotEmpty") name: string) {
99
+ const info = await this.testService.sayHello(name).catch((err: any) => this.fail(err.message));
100
+ return info;
101
+ }
102
+
103
+ @PostMapping("/test")
104
+ @Validated() //need DTOClass
105
+ test(@RequestParam() params: TestDTO) {
106
+ return this.ok("test", params);
107
+ }
108
+ }
109
+ ```
110
+
111
+ ## How to debug
112
+
113
+ if you use vscode , edit the `.vscode/launch.json` , like this:
114
+ ```
115
+ {
116
+ "version": "0.2.0",
117
+ "configurations": [
118
+ {
119
+ "type": "node",
120
+ "request": "launch",
121
+ "name": "TS Program",
122
+ "args": [
123
+ "${workspaceRoot}/src/App.ts"
124
+ ],
125
+ "runtimeArgs": [
126
+ "--nolazy",
127
+ "-r",
128
+ "ts-node/register"
129
+ ],
130
+ "sourceMaps": true,
131
+ "cwd": "${workspaceRoot}",
132
+ "protocol": "inspector",
133
+ "internalConsoleOptions": "neverOpen"
134
+ }
135
+ ]
136
+ }
137
+ ```
138
+ Select `TS Program` to debug run. Try to call `http://localhost:3000/` .
139
+
140
+ ## Example
141
+
142
+ Check out the [quick start example][quick-example].
143
+
144
+ [quick-example]: https://github.com/thinkkoa/koatty_demo/
145
+
146
+
147
+