koatty 3.5.12-1 → 3.5.14
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 +8 -0
- package/dist/index.d.ts +17 -13
- package/dist/index.js +33 -43
- package/dist/index.mjs +33 -43
- package/dist/package.json +8 -8
- package/package.json +8 -8
- package/.commitlintrc.js +0 -3
- package/.eslintignore +0 -11
- package/.eslintrc.js +0 -43
- package/.huskyrc +0 -5
- package/.versionrc.js +0 -16
- package/api-extractor.json +0 -345
- package/docs/api/index.md +0 -12
- package/docs/api/koatty.apiinput.code.md +0 -11
- package/docs/api/koatty.apiinput.data.md +0 -11
- package/docs/api/koatty.apiinput.md +0 -22
- package/docs/api/koatty.apiinput.message.md +0 -11
- package/docs/api/koatty.apioutput.code.md +0 -11
- package/docs/api/koatty.apioutput.data.md +0 -11
- package/docs/api/koatty.apioutput.md +0 -22
- package/docs/api/koatty.apioutput.message.md +0 -11
- package/docs/api/koatty.appreadyhookfunc.md +0 -11
- package/docs/api/koatty.basecontroller._constructor_.md +0 -20
- package/docs/api/koatty.basecontroller._options.md +0 -11
- package/docs/api/koatty.basecontroller.app.md +0 -11
- package/docs/api/koatty.basecontroller.ctx.md +0 -11
- package/docs/api/koatty.basecontroller.fail.md +0 -28
- package/docs/api/koatty.basecontroller.init.md +0 -19
- package/docs/api/koatty.basecontroller.md +0 -39
- package/docs/api/koatty.basecontroller.ok.md +0 -28
- package/docs/api/koatty.baseservice._constructor_.md +0 -20
- package/docs/api/koatty.baseservice._options.md +0 -11
- package/docs/api/koatty.baseservice.app.md +0 -11
- package/docs/api/koatty.baseservice.init.md +0 -25
- package/docs/api/koatty.baseservice.md +0 -36
- package/docs/api/koatty.bindappreadyhook.md +0 -26
- package/docs/api/koatty.bootstrap.md +0 -27
- package/docs/api/koatty.component.md +0 -27
- package/docs/api/koatty.componentscan.md +0 -27
- package/docs/api/koatty.configurationscan.md +0 -27
- package/docs/api/koatty.controller.md +0 -27
- package/docs/api/koatty.httpcontroller.body.md +0 -28
- package/docs/api/koatty.httpcontroller.deny.md +0 -26
- package/docs/api/koatty.httpcontroller.expires.md +0 -26
- package/docs/api/koatty.httpcontroller.fail.md +0 -28
- package/docs/api/koatty.httpcontroller.header.md +0 -27
- package/docs/api/koatty.httpcontroller.isget.md +0 -19
- package/docs/api/koatty.httpcontroller.ismethod.md +0 -26
- package/docs/api/koatty.httpcontroller.ispost.md +0 -19
- package/docs/api/koatty.httpcontroller.json.md +0 -26
- package/docs/api/koatty.httpcontroller.md +0 -35
- package/docs/api/koatty.httpcontroller.ok.md +0 -28
- package/docs/api/koatty.httpcontroller.param.md +0 -26
- package/docs/api/koatty.httpcontroller.redirect.md +0 -27
- package/docs/api/koatty.httpcontroller.type.md +0 -27
- package/docs/api/koatty.icontroller.__after.md +0 -11
- package/docs/api/koatty.icontroller.__befor.md +0 -11
- package/docs/api/koatty.icontroller.app.md +0 -11
- package/docs/api/koatty.icontroller.ctx.md +0 -11
- package/docs/api/koatty.icontroller.fail.md +0 -11
- package/docs/api/koatty.icontroller.md +0 -25
- package/docs/api/koatty.icontroller.ok.md +0 -11
- package/docs/api/koatty.imiddleware.md +0 -20
- package/docs/api/koatty.imiddleware.run.md +0 -11
- package/docs/api/koatty.iplugin.md +0 -20
- package/docs/api/koatty.iplugin.run.md +0 -11
- package/docs/api/koatty.iservice.app.md +0 -11
- package/docs/api/koatty.iservice.md +0 -20
- package/docs/api/koatty.logger.md +0 -11
- package/docs/api/koatty.md +0 -51
- package/docs/api/koatty.middleware.md +0 -27
- package/docs/api/koatty.plugin.md +0 -27
- package/docs/api/koatty.service.md +0 -27
- package/jest.config.js +0 -34
- package/jest_html_reporters.html +0 -60
- package/rollup.config.js +0 -63
- package/scripts/copyright.js +0 -28
- package/scripts/postBuild.js +0 -10
- package/tsconfig.json +0 -69
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IController](./koatty.icontroller.md) > [\_\_befor](./koatty.icontroller.__befor.md)
|
4
|
-
|
5
|
-
## IController.\_\_befor property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
__befor?: () => Promise<any>;
|
11
|
-
```
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IController](./koatty.icontroller.md) > [app](./koatty.icontroller.app.md)
|
4
|
-
|
5
|
-
## IController.app property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
app: Koatty;
|
11
|
-
```
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IController](./koatty.icontroller.md) > [ctx](./koatty.icontroller.ctx.md)
|
4
|
-
|
5
|
-
## IController.ctx property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
readonly ctx: KoattyContext;
|
11
|
-
```
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IController](./koatty.icontroller.md) > [fail](./koatty.icontroller.fail.md)
|
4
|
-
|
5
|
-
## IController.fail property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
readonly fail: (msg?: Error | string | ApiInput, data?: any, ret?: number) => Promise<any>;
|
11
|
-
```
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IController](./koatty.icontroller.md)
|
4
|
-
|
5
|
-
## IController interface
|
6
|
-
|
7
|
-
Interface for Controller
|
8
|
-
|
9
|
-
<b>Signature:</b>
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
export interface IController
|
13
|
-
```
|
14
|
-
|
15
|
-
## Properties
|
16
|
-
|
17
|
-
| Property | Type | Description |
|
18
|
-
| --- | --- | --- |
|
19
|
-
| [\_\_after?](./koatty.icontroller.__after.md) | () => Promise<any> | <i>(Optional)</i> |
|
20
|
-
| [\_\_befor?](./koatty.icontroller.__befor.md) | () => Promise<any> | <i>(Optional)</i> |
|
21
|
-
| [app](./koatty.icontroller.app.md) | Koatty | |
|
22
|
-
| [ctx](./koatty.icontroller.ctx.md) | KoattyContext | |
|
23
|
-
| [fail](./koatty.icontroller.fail.md) | (msg?: Error \| string \| [ApiInput](./koatty.apiinput.md)<!-- -->, data?: any, ret?: number) => Promise<any> | |
|
24
|
-
| [ok](./koatty.icontroller.ok.md) | (msg?: string \| [ApiInput](./koatty.apiinput.md)<!-- -->, data?: any, ret?: number) => Promise<any> | |
|
25
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IController](./koatty.icontroller.md) > [ok](./koatty.icontroller.ok.md)
|
4
|
-
|
5
|
-
## IController.ok property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
readonly ok: (msg?: string | ApiInput, data?: any, ret?: number) => Promise<any>;
|
11
|
-
```
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IMiddleware](./koatty.imiddleware.md)
|
4
|
-
|
5
|
-
## IMiddleware interface
|
6
|
-
|
7
|
-
Interface for Middleware
|
8
|
-
|
9
|
-
<b>Signature:</b>
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
export interface IMiddleware
|
13
|
-
```
|
14
|
-
|
15
|
-
## Properties
|
16
|
-
|
17
|
-
| Property | Type | Description |
|
18
|
-
| --- | --- | --- |
|
19
|
-
| [run](./koatty.imiddleware.run.md) | (options: any, app: Koatty) => Koa.Middleware | |
|
20
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IMiddleware](./koatty.imiddleware.md) > [run](./koatty.imiddleware.run.md)
|
4
|
-
|
5
|
-
## IMiddleware.run property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
run: (options: any, app: Koatty) => Koa.Middleware;
|
11
|
-
```
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IPlugin](./koatty.iplugin.md)
|
4
|
-
|
5
|
-
## IPlugin interface
|
6
|
-
|
7
|
-
Interface for Plugin
|
8
|
-
|
9
|
-
<b>Signature:</b>
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
export interface IPlugin
|
13
|
-
```
|
14
|
-
|
15
|
-
## Properties
|
16
|
-
|
17
|
-
| Property | Type | Description |
|
18
|
-
| --- | --- | --- |
|
19
|
-
| [run](./koatty.iplugin.run.md) | (options: any, app: Koatty) => Promise<any> | |
|
20
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IPlugin](./koatty.iplugin.md) > [run](./koatty.iplugin.run.md)
|
4
|
-
|
5
|
-
## IPlugin.run property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
run: (options: any, app: Koatty) => Promise<any>;
|
11
|
-
```
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IService](./koatty.iservice.md) > [app](./koatty.iservice.app.md)
|
4
|
-
|
5
|
-
## IService.app property
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
app: Koatty;
|
11
|
-
```
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [IService](./koatty.iservice.md)
|
4
|
-
|
5
|
-
## IService interface
|
6
|
-
|
7
|
-
Interface for Service
|
8
|
-
|
9
|
-
<b>Signature:</b>
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
export interface IService
|
13
|
-
```
|
14
|
-
|
15
|
-
## Properties
|
16
|
-
|
17
|
-
| Property | Type | Description |
|
18
|
-
| --- | --- | --- |
|
19
|
-
| [app](./koatty.iservice.app.md) | Koatty | |
|
20
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [Logger](./koatty.logger.md)
|
4
|
-
|
5
|
-
## Logger variable
|
6
|
-
|
7
|
-
<b>Signature:</b>
|
8
|
-
|
9
|
-
```typescript
|
10
|
-
Logger: import("koatty_logger").Logger
|
11
|
-
```
|
package/docs/api/koatty.md
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md)
|
4
|
-
|
5
|
-
## koatty package
|
6
|
-
|
7
|
-
## Classes
|
8
|
-
|
9
|
-
| Class | Description |
|
10
|
-
| --- | --- |
|
11
|
-
| [BaseController](./koatty.basecontroller.md) | Base controller BaseController {<!-- -->IController<!-- -->} |
|
12
|
-
| [BaseService](./koatty.baseservice.md) | Base class Base |
|
13
|
-
| [HttpController](./koatty.httpcontroller.md) | HTTP controller HttpController {<!-- -->IController<!-- -->} |
|
14
|
-
|
15
|
-
## Functions
|
16
|
-
|
17
|
-
| Function | Description |
|
18
|
-
| --- | --- |
|
19
|
-
| [BindAppReadyHook(func, target)](./koatty.bindappreadyhook.md) | bind AppReadyHookFunc example: export function TestDecorator(): ClassDecorator { return (target: any) =<!-- -->> { BindAppReadyHook((app: Koatty) =<!-- -->> { // todo return Promise.resolve(); }<!-- -->, target) } } |
|
20
|
-
| [Bootstrap(bootFunc)](./koatty.bootstrap.md) | Bootstrap application |
|
21
|
-
| [Component(identifier)](./koatty.component.md) | Indicates that an decorated class is a "component". |
|
22
|
-
| [ComponentScan(scanPath)](./koatty.componentscan.md) | Define project scan path |
|
23
|
-
| [ConfigurationScan(scanPath)](./koatty.configurationscan.md) | Define project configuration scan path |
|
24
|
-
| [Controller(path)](./koatty.controller.md) | Indicates that an decorated class is a "controller". |
|
25
|
-
| [Middleware(identifier)](./koatty.middleware.md) | Indicates that an decorated class is a "middleware". |
|
26
|
-
| [Plugin(identifier)](./koatty.plugin.md) | Indicates that an decorated class is a "plugin". |
|
27
|
-
| [Service(identifier)](./koatty.service.md) | Indicates that an decorated class is a "service". |
|
28
|
-
|
29
|
-
## Interfaces
|
30
|
-
|
31
|
-
| Interface | Description |
|
32
|
-
| --- | --- |
|
33
|
-
| [ApiInput](./koatty.apiinput.md) | Interface for Api input |
|
34
|
-
| [ApiOutput](./koatty.apioutput.md) | Interface for Api output |
|
35
|
-
| [IController](./koatty.icontroller.md) | Interface for Controller |
|
36
|
-
| [IMiddleware](./koatty.imiddleware.md) | Interface for Middleware |
|
37
|
-
| [IPlugin](./koatty.iplugin.md) | Interface for Plugin |
|
38
|
-
| [IService](./koatty.iservice.md) | Interface for Service |
|
39
|
-
|
40
|
-
## Variables
|
41
|
-
|
42
|
-
| Variable | Description |
|
43
|
-
| --- | --- |
|
44
|
-
| [Logger](./koatty.logger.md) | |
|
45
|
-
|
46
|
-
## Type Aliases
|
47
|
-
|
48
|
-
| Type Alias | Description |
|
49
|
-
| --- | --- |
|
50
|
-
| [AppReadyHookFunc](./koatty.appreadyhookfunc.md) | |
|
51
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [Middleware](./koatty.middleware.md)
|
4
|
-
|
5
|
-
## Middleware() function
|
6
|
-
|
7
|
-
Indicates that an decorated class is a "middleware".
|
8
|
-
|
9
|
-
|
10
|
-
<b>Signature:</b>
|
11
|
-
|
12
|
-
```typescript
|
13
|
-
export declare function Middleware(identifier?: string): ClassDecorator;
|
14
|
-
```
|
15
|
-
|
16
|
-
## Parameters
|
17
|
-
|
18
|
-
| Parameter | Type | Description |
|
19
|
-
| --- | --- | --- |
|
20
|
-
| identifier | string | middleware name |
|
21
|
-
|
22
|
-
<b>Returns:</b>
|
23
|
-
|
24
|
-
ClassDecorator
|
25
|
-
|
26
|
-
{<!-- -->ClassDecorator<!-- -->}
|
27
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [Plugin](./koatty.plugin.md)
|
4
|
-
|
5
|
-
## Plugin() function
|
6
|
-
|
7
|
-
Indicates that an decorated class is a "plugin".
|
8
|
-
|
9
|
-
|
10
|
-
<b>Signature:</b>
|
11
|
-
|
12
|
-
```typescript
|
13
|
-
export declare function Plugin(identifier?: string): ClassDecorator;
|
14
|
-
```
|
15
|
-
|
16
|
-
## Parameters
|
17
|
-
|
18
|
-
| Parameter | Type | Description |
|
19
|
-
| --- | --- | --- |
|
20
|
-
| identifier | string | |
|
21
|
-
|
22
|
-
<b>Returns:</b>
|
23
|
-
|
24
|
-
ClassDecorator
|
25
|
-
|
26
|
-
{<!-- -->ClassDecorator<!-- -->}
|
27
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
-
|
3
|
-
[Home](./index.md) > [koatty](./koatty.md) > [Service](./koatty.service.md)
|
4
|
-
|
5
|
-
## Service() function
|
6
|
-
|
7
|
-
Indicates that an decorated class is a "service".
|
8
|
-
|
9
|
-
|
10
|
-
<b>Signature:</b>
|
11
|
-
|
12
|
-
```typescript
|
13
|
-
export declare function Service(identifier?: string): ClassDecorator;
|
14
|
-
```
|
15
|
-
|
16
|
-
## Parameters
|
17
|
-
|
18
|
-
| Parameter | Type | Description |
|
19
|
-
| --- | --- | --- |
|
20
|
-
| identifier | string | middleware name |
|
21
|
-
|
22
|
-
<b>Returns:</b>
|
23
|
-
|
24
|
-
ClassDecorator
|
25
|
-
|
26
|
-
{<!-- -->ClassDecorator<!-- -->}
|
27
|
-
|
package/jest.config.js
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
*
|
3
|
-
*/
|
4
|
-
|
5
|
-
// jest详细配置参见:
|
6
|
-
// https://jestjs.io/docs/en/configuration.html
|
7
|
-
|
8
|
-
module.exports = {
|
9
|
-
preset: 'ts-jest',
|
10
|
-
testEnvironment: 'node', // 测试用例运行环境
|
11
|
-
testMatch: ['<rootDir>/test/**/*.(spec|test).[jt]s'], // 匹配测试用例的路径规则
|
12
|
-
reporters: [
|
13
|
-
'default',
|
14
|
-
'jest-html-reporters'
|
15
|
-
], // 测试用例报告
|
16
|
-
collectCoverage: true, // 是否收集测试时的覆盖率信息
|
17
|
-
coverageReporters: [
|
18
|
-
'html',
|
19
|
-
'lcov',
|
20
|
-
'json',
|
21
|
-
'text',
|
22
|
-
'clover',
|
23
|
-
'text-summary',
|
24
|
-
], // 收集测试时的覆盖率信息
|
25
|
-
// 将 `ts-jest` 的配置注入到运行时的全局变量中
|
26
|
-
globals: {
|
27
|
-
'ts-jest': {
|
28
|
-
// 编译 Typescript 所依赖的配置
|
29
|
-
tsconfig: '<rootDir>/tsconfig.json',
|
30
|
-
// 是否启用报告诊断,这里是不启用
|
31
|
-
diagnostics: false,
|
32
|
-
},
|
33
|
-
}
|
34
|
-
};
|