@tsed/platform-koa 7.0.0-beta.7 → 7.0.0-rc.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.
- package/coverage.json +6 -0
- package/jest.config.js +9 -0
- package/lib/cjs/components/PlatformKoa.js +75 -55
- package/lib/cjs/components/PlatformKoa.js.map +1 -1
- package/lib/cjs/index.js +0 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformKoaSettings.js.map +1 -1
- package/lib/cjs/services/PlatformKoaHandler.js +6 -48
- package/lib/cjs/services/PlatformKoaHandler.js.map +1 -1
- package/lib/cjs/services/PlatformKoaRequest.js +8 -18
- package/lib/cjs/services/PlatformKoaRequest.js.map +1 -1
- package/lib/cjs/services/PlatformKoaResponse.js +3 -7
- package/lib/cjs/services/PlatformKoaResponse.js.map +1 -1
- package/lib/esm/components/PlatformKoa.js +76 -56
- package/lib/esm/components/PlatformKoa.js.map +1 -1
- package/lib/esm/index.js +0 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformKoaSettings.js.map +1 -1
- package/lib/esm/services/PlatformKoaHandler.js +7 -49
- package/lib/esm/services/PlatformKoaHandler.js.map +1 -1
- package/lib/esm/services/PlatformKoaRequest.js +8 -18
- package/lib/esm/services/PlatformKoaRequest.js.map +1 -1
- package/lib/esm/services/PlatformKoaResponse.js +3 -8
- package/lib/esm/services/PlatformKoaResponse.js.map +1 -1
- package/lib/types/components/PlatformKoa.d.ts +10 -17
- package/lib/types/index.d.ts +0 -4
- package/lib/types/interfaces/PlatformKoaSettings.d.ts +1 -1
- package/lib/types/services/PlatformKoaHandler.d.ts +2 -7
- package/lib/types/services/PlatformKoaRequest.d.ts +3 -6
- package/lib/types/services/PlatformKoaResponse.d.ts +2 -3
- package/package.json +25 -17
- package/readme.md +3 -2
- package/lib/cjs/decorators/caseSensitive.js +0 -30
- package/lib/cjs/decorators/caseSensitive.js.map +0 -1
- package/lib/cjs/decorators/routerSettings.js +0 -31
- package/lib/cjs/decorators/routerSettings.js.map +0 -1
- package/lib/cjs/decorators/strict.js +0 -31
- package/lib/cjs/decorators/strict.js.map +0 -1
- package/lib/cjs/middlewares/resourceNotFoundMiddleware.js +0 -20
- package/lib/cjs/middlewares/resourceNotFoundMiddleware.js.map +0 -1
- package/lib/esm/decorators/caseSensitive.js +0 -26
- package/lib/esm/decorators/caseSensitive.js.map +0 -1
- package/lib/esm/decorators/routerSettings.js +0 -27
- package/lib/esm/decorators/routerSettings.js.map +0 -1
- package/lib/esm/decorators/strict.js +0 -27
- package/lib/esm/decorators/strict.js.map +0 -1
- package/lib/esm/middlewares/resourceNotFoundMiddleware.js +0 -16
- package/lib/esm/middlewares/resourceNotFoundMiddleware.js.map +0 -1
- package/lib/types/decorators/caseSensitive.d.ts +0 -22
- package/lib/types/decorators/routerSettings.d.ts +0 -24
- package/lib/types/decorators/strict.d.ts +0 -23
- package/lib/types/middlewares/resourceNotFoundMiddleware.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-koa",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-rc.1",
|
|
4
4
|
"description": "Koa package for Ts.ED framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
19
19
|
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
20
|
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
21
|
-
"start": "ts-node -r tsconfig-paths/register test/app/index.ts"
|
|
21
|
+
"start": "ts-node -r tsconfig-paths/register test/app/index.ts",
|
|
22
|
+
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2 --testTimeout 10000"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
24
25
|
"Koa",
|
|
@@ -47,14 +48,14 @@
|
|
|
47
48
|
"bugs": {
|
|
48
49
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
49
50
|
},
|
|
50
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
51
|
+
"homepage": "https://github.com/tsedio/tsed/tree/rc/packages/platform/platform-koa",
|
|
51
52
|
"repository": "https://github.com/tsedio/tsed",
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@koa/cors": "3.3.0",
|
|
54
|
-
"@tsed/common": "7.0.0-
|
|
55
|
-
"@tsed/core": "7.0.0-
|
|
56
|
-
"@tsed/di": "7.0.0-
|
|
57
|
-
"@tsed/platform-test-utils": "7.0.0-
|
|
55
|
+
"@tsed/common": "7.0.0-rc.1",
|
|
56
|
+
"@tsed/core": "7.0.0-rc.1",
|
|
57
|
+
"@tsed/di": "7.0.0-rc.1",
|
|
58
|
+
"@tsed/platform-test-utils": "7.0.0-rc.1",
|
|
58
59
|
"@types/koa": "2.13.4",
|
|
59
60
|
"@types/koa-bodyparser": "4.3.7",
|
|
60
61
|
"@types/koa-compose": "3.2.5",
|
|
@@ -75,23 +76,24 @@
|
|
|
75
76
|
"@koa/router": "^10.1.1",
|
|
76
77
|
"encodeurl": "^1.0.2",
|
|
77
78
|
"koa-send": "5.0.1",
|
|
78
|
-
"multer": "^1.4.
|
|
79
|
-
"tslib": "2.
|
|
79
|
+
"multer": "^1.4.5-lts.1",
|
|
80
|
+
"tslib": "2.4.0"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
82
|
-
"@tsed/common": "^7.0.0-
|
|
83
|
-
"@tsed/core": "^7.0.0-
|
|
84
|
-
"@tsed/di": "^7.0.0-
|
|
85
|
-
"@tsed/json-mapper": "^7.0.0-
|
|
86
|
-
"@tsed/logger": ">=6.
|
|
87
|
-
"@tsed/openspec": "^7.0.0-
|
|
88
|
-
"@tsed/schema": "^7.0.0-
|
|
83
|
+
"@tsed/common": "^7.0.0-rc.1",
|
|
84
|
+
"@tsed/core": "^7.0.0-rc.1",
|
|
85
|
+
"@tsed/di": "^7.0.0-rc.1",
|
|
86
|
+
"@tsed/json-mapper": "^7.0.0-rc.1",
|
|
87
|
+
"@tsed/logger": ">=6.2.0",
|
|
88
|
+
"@tsed/openspec": "^7.0.0-rc.1",
|
|
89
|
+
"@tsed/schema": "^7.0.0-rc.1",
|
|
89
90
|
"koa": ">=2.13.0",
|
|
90
91
|
"koa-bodyparser": ">=4.3.0",
|
|
91
92
|
"koa-compress": ">=5.0.1",
|
|
92
93
|
"koa-override": ">=3.0.0",
|
|
93
94
|
"koa-qs": ">=3.0.0",
|
|
94
|
-
"koa-session": ">=6.2.0"
|
|
95
|
+
"koa-session": ">=6.2.0",
|
|
96
|
+
"multer": "^1.4.5-lts.1"
|
|
95
97
|
},
|
|
96
98
|
"peerDependenciesMeta": {
|
|
97
99
|
"@tsed/common": {
|
|
@@ -114,6 +116,12 @@
|
|
|
114
116
|
},
|
|
115
117
|
"@tsed/logger": {
|
|
116
118
|
"optional": false
|
|
119
|
+
},
|
|
120
|
+
"multer": {
|
|
121
|
+
"optional": false
|
|
117
122
|
}
|
|
123
|
+
},
|
|
124
|
+
"publishConfig": {
|
|
125
|
+
"tag": "rc"
|
|
118
126
|
}
|
|
119
127
|
}
|
package/readme.md
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
[](https://badge.fury.io/js/%40tsed%2Fcommon)
|
|
12
12
|
[](https://github.com/semantic-release/semantic-release)
|
|
13
13
|
[](https://github.com/prettier/prettier)
|
|
14
|
-
[](https://github.com/sponsors/romakita)
|
|
15
|
+
[](https://opencollective.com/tsed)
|
|
15
16
|
|
|
16
17
|
</div>
|
|
17
18
|
|
|
@@ -58,7 +59,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
|
58
59
|
|
|
59
60
|
The MIT License (MIT)
|
|
60
61
|
|
|
61
|
-
Copyright (c) 2016 -
|
|
62
|
+
Copyright (c) 2016 - 2022 Romain Lenzotti
|
|
62
63
|
|
|
63
64
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
64
65
|
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CaseSensitive = void 0;
|
|
4
|
-
const routerSettings_1 = require("./routerSettings");
|
|
5
|
-
/**
|
|
6
|
-
* Specify the behavior of the router controller.
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @Controller("/")
|
|
10
|
-
* @CaseSensitive(true)
|
|
11
|
-
* class MyCtrl {
|
|
12
|
-
*
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Property | Description | Default
|
|
17
|
-
* ---|---|---
|
|
18
|
-
* CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
19
|
-
* Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
20
|
-
*
|
|
21
|
-
* @returns {Function}
|
|
22
|
-
* @decorator
|
|
23
|
-
* @koa
|
|
24
|
-
* @param sensitive
|
|
25
|
-
*/
|
|
26
|
-
function CaseSensitive(sensitive) {
|
|
27
|
-
return (0, routerSettings_1.RouterSettings)({ sensitive });
|
|
28
|
-
}
|
|
29
|
-
exports.CaseSensitive = CaseSensitive;
|
|
30
|
-
//# sourceMappingURL=caseSensitive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"caseSensitive.js","sourceRoot":"","sources":["../../../src/decorators/caseSensitive.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,aAAa,CAAC,SAAkB;IAC9C,OAAO,IAAA,+BAAc,EAAC,EAAC,SAAS,EAAC,CAAC,CAAC;AACrC,CAAC;AAFD,sCAEC","sourcesContent":["import {RouterSettings} from \"./routerSettings\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @CaseSensitive(true)\n * class MyCtrl {\n *\n * }\n * ```\n *\n * Property | Description | Default\n * ---|---|---\n * CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.\n * Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.\n *\n * @returns {Function}\n * @decorator\n * @koa\n * @param sensitive\n */\nexport function CaseSensitive(sensitive: boolean) {\n return RouterSettings({sensitive});\n}\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RouterSettings = void 0;
|
|
4
|
-
const common_1 = require("@tsed/common");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
|
-
/**
|
|
7
|
-
* Specify the behavior of the router controller.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Controller("/")
|
|
11
|
-
* @RouterSettings({sensitive: true})
|
|
12
|
-
* class MyCtrl {
|
|
13
|
-
*
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* Property | Description | Default
|
|
18
|
-
* ---|---|---
|
|
19
|
-
* sensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
20
|
-
* strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
21
|
-
*
|
|
22
|
-
* @returns {(target:any)=>void}
|
|
23
|
-
* @decorator
|
|
24
|
-
* @param routerOptions
|
|
25
|
-
* @koa
|
|
26
|
-
*/
|
|
27
|
-
function RouterSettings(routerOptions) {
|
|
28
|
-
return (0, core_1.StoreMerge)(common_1.ROUTER_OPTIONS, routerOptions);
|
|
29
|
-
}
|
|
30
|
-
exports.RouterSettings = RouterSettings;
|
|
31
|
-
//# sourceMappingURL=routerSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routerSettings.js","sourceRoot":"","sources":["../../../src/decorators/routerSettings.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAC5C,qCAAsC;AAGtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,cAAc,CAAC,aAA4B;IACzD,OAAO,IAAA,iBAAU,EAAC,uBAAc,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC;AAFD,wCAEC","sourcesContent":["import {ROUTER_OPTIONS} from \"@tsed/common\";\nimport {StoreMerge} from \"@tsed/core\";\nimport {RouterOptions} from \"@koa/router\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @RouterSettings({sensitive: true})\n * class MyCtrl {\n *\n * }\n * ```\n *\n * Property | Description | Default\n * ---|---|---\n * sensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.\n * strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.\n *\n * @returns {(target:any)=>void}\n * @decorator\n * @param routerOptions\n * @koa\n */\nexport function RouterSettings(routerOptions: RouterOptions): Function {\n return StoreMerge(ROUTER_OPTIONS, routerOptions);\n}\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Strict = void 0;
|
|
4
|
-
const routerSettings_1 = require("./routerSettings");
|
|
5
|
-
/**
|
|
6
|
-
* Specify the behavior of the router controller.
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @Controller("/")
|
|
10
|
-
* @Strict(true)
|
|
11
|
-
* class MyCtrl {
|
|
12
|
-
*
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Property | Description | Default
|
|
17
|
-
* ---|---|---
|
|
18
|
-
* CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
19
|
-
* MergeParams | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. | false
|
|
20
|
-
* Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
21
|
-
*
|
|
22
|
-
* @param strict
|
|
23
|
-
* @returns {Function}
|
|
24
|
-
* @decorator
|
|
25
|
-
* @koa
|
|
26
|
-
*/
|
|
27
|
-
function Strict(strict) {
|
|
28
|
-
return (0, routerSettings_1.RouterSettings)({ strict });
|
|
29
|
-
}
|
|
30
|
-
exports.Strict = Strict;
|
|
31
|
-
//# sourceMappingURL=strict.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strict.js","sourceRoot":"","sources":["../../../src/decorators/strict.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,MAAM,CAAC,MAAe;IACpC,OAAO,IAAA,+BAAc,EAAC,EAAC,MAAM,EAAC,CAAC,CAAC;AAClC,CAAC;AAFD,wBAEC","sourcesContent":["import {RouterSettings} from \"./routerSettings\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @Strict(true)\n * class MyCtrl {\n *\n * }\n * ```\n *\n * Property | Description | Default\n * ---|---|---\n * CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.\n * MergeParams | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. | false\n * Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.\n *\n * @param strict\n * @returns {Function}\n * @decorator\n * @koa\n */\nexport function Strict(strict: boolean) {\n return RouterSettings({strict});\n}\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resourceNotFoundMiddleware = void 0;
|
|
4
|
-
const platform_exceptions_1 = require("@tsed/platform-exceptions");
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
* @param ctx
|
|
8
|
-
* @param next
|
|
9
|
-
*/
|
|
10
|
-
async function resourceNotFoundMiddleware(ctx, next) {
|
|
11
|
-
var _a;
|
|
12
|
-
const $ctx = ctx.request.$ctx;
|
|
13
|
-
await next();
|
|
14
|
-
const status = ctx.status || 404;
|
|
15
|
-
if (status === 404 && !$ctx.isDone()) {
|
|
16
|
-
(_a = $ctx.injector.get(platform_exceptions_1.PlatformExceptions)) === null || _a === void 0 ? void 0 : _a.resourceNotFound($ctx);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.resourceNotFoundMiddleware = resourceNotFoundMiddleware;
|
|
20
|
-
//# sourceMappingURL=resourceNotFoundMiddleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resourceNotFoundMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/resourceNotFoundMiddleware.ts"],"names":[],"mappings":";;;AACA,mEAA6D;AAE7D;;;;GAIG;AACI,KAAK,UAAU,0BAA0B,CAAC,GAAQ,EAAE,IAAS;;IAClE,MAAM,IAAI,GAAoB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/C,MAAM,IAAI,EAAE,CAAC;IACb,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC;IAEjC,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;QACpC,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAqB,wCAAkB,CAAC,0CAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;KACnF;AACH,CAAC;AARD,gEAQC","sourcesContent":["import {PlatformContext} from \"@tsed/common\";\nimport {PlatformExceptions} from \"@tsed/platform-exceptions\";\n\n/**\n * @ignore\n * @param ctx\n * @param next\n */\nexport async function resourceNotFoundMiddleware(ctx: any, next: any) {\n const $ctx: PlatformContext = ctx.request.$ctx;\n await next();\n const status = ctx.status || 404;\n\n if (status === 404 && !$ctx.isDone()) {\n $ctx.injector.get<PlatformExceptions>(PlatformExceptions)?.resourceNotFound($ctx);\n }\n}\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { RouterSettings } from "./routerSettings.js";
|
|
2
|
-
/**
|
|
3
|
-
* Specify the behavior of the router controller.
|
|
4
|
-
*
|
|
5
|
-
* ```typescript
|
|
6
|
-
* @Controller("/")
|
|
7
|
-
* @CaseSensitive(true)
|
|
8
|
-
* class MyCtrl {
|
|
9
|
-
*
|
|
10
|
-
* }
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Property | Description | Default
|
|
14
|
-
* ---|---|---
|
|
15
|
-
* CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
16
|
-
* Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
17
|
-
*
|
|
18
|
-
* @returns {Function}
|
|
19
|
-
* @decorator
|
|
20
|
-
* @koa
|
|
21
|
-
* @param sensitive
|
|
22
|
-
*/
|
|
23
|
-
export function CaseSensitive(sensitive) {
|
|
24
|
-
return RouterSettings({ sensitive });
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=caseSensitive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"caseSensitive.js","sourceRoot":"","sources":["../../../src/decorators/caseSensitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,SAAkB;IAC9C,OAAO,cAAc,CAAC,EAAC,SAAS,EAAC,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import {RouterSettings} from \"./routerSettings\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @CaseSensitive(true)\n * class MyCtrl {\n *\n * }\n * ```\n *\n * Property | Description | Default\n * ---|---|---\n * CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.\n * Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.\n *\n * @returns {Function}\n * @decorator\n * @koa\n * @param sensitive\n */\nexport function CaseSensitive(sensitive: boolean) {\n return RouterSettings({sensitive});\n}\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ROUTER_OPTIONS } from "@tsed/common";
|
|
2
|
-
import { StoreMerge } from "@tsed/core";
|
|
3
|
-
/**
|
|
4
|
-
* Specify the behavior of the router controller.
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* @Controller("/")
|
|
8
|
-
* @RouterSettings({sensitive: true})
|
|
9
|
-
* class MyCtrl {
|
|
10
|
-
*
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* Property | Description | Default
|
|
15
|
-
* ---|---|---
|
|
16
|
-
* sensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
17
|
-
* strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
18
|
-
*
|
|
19
|
-
* @returns {(target:any)=>void}
|
|
20
|
-
* @decorator
|
|
21
|
-
* @param routerOptions
|
|
22
|
-
* @koa
|
|
23
|
-
*/
|
|
24
|
-
export function RouterSettings(routerOptions) {
|
|
25
|
-
return StoreMerge(ROUTER_OPTIONS, routerOptions);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=routerSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routerSettings.js","sourceRoot":"","sources":["../../../src/decorators/routerSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAAC,aAA4B;IACzD,OAAO,UAAU,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import {ROUTER_OPTIONS} from \"@tsed/common\";\nimport {StoreMerge} from \"@tsed/core\";\nimport {RouterOptions} from \"@koa/router\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @RouterSettings({sensitive: true})\n * class MyCtrl {\n *\n * }\n * ```\n *\n * Property | Description | Default\n * ---|---|---\n * sensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.\n * strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.\n *\n * @returns {(target:any)=>void}\n * @decorator\n * @param routerOptions\n * @koa\n */\nexport function RouterSettings(routerOptions: RouterOptions): Function {\n return StoreMerge(ROUTER_OPTIONS, routerOptions);\n}\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { RouterSettings } from "./routerSettings.js";
|
|
2
|
-
/**
|
|
3
|
-
* Specify the behavior of the router controller.
|
|
4
|
-
*
|
|
5
|
-
* ```typescript
|
|
6
|
-
* @Controller("/")
|
|
7
|
-
* @Strict(true)
|
|
8
|
-
* class MyCtrl {
|
|
9
|
-
*
|
|
10
|
-
* }
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Property | Description | Default
|
|
14
|
-
* ---|---|---
|
|
15
|
-
* CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
16
|
-
* MergeParams | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. | false
|
|
17
|
-
* Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
18
|
-
*
|
|
19
|
-
* @param strict
|
|
20
|
-
* @returns {Function}
|
|
21
|
-
* @decorator
|
|
22
|
-
* @koa
|
|
23
|
-
*/
|
|
24
|
-
export function Strict(strict) {
|
|
25
|
-
return RouterSettings({ strict });
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=strict.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strict.js","sourceRoot":"","sources":["../../../src/decorators/strict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,OAAO,cAAc,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import {RouterSettings} from \"./routerSettings\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @Strict(true)\n * class MyCtrl {\n *\n * }\n * ```\n *\n * Property | Description | Default\n * ---|---|---\n * CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.\n * MergeParams | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. | false\n * Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.\n *\n * @param strict\n * @returns {Function}\n * @decorator\n * @koa\n */\nexport function Strict(strict: boolean) {\n return RouterSettings({strict});\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
2
|
-
/**
|
|
3
|
-
* @ignore
|
|
4
|
-
* @param ctx
|
|
5
|
-
* @param next
|
|
6
|
-
*/
|
|
7
|
-
export async function resourceNotFoundMiddleware(ctx, next) {
|
|
8
|
-
var _a;
|
|
9
|
-
const $ctx = ctx.request.$ctx;
|
|
10
|
-
await next();
|
|
11
|
-
const status = ctx.status || 404;
|
|
12
|
-
if (status === 404 && !$ctx.isDone()) {
|
|
13
|
-
(_a = $ctx.injector.get(PlatformExceptions)) === null || _a === void 0 ? void 0 : _a.resourceNotFound($ctx);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=resourceNotFoundMiddleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resourceNotFoundMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/resourceNotFoundMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,GAAQ,EAAE,IAAS;;IAClE,MAAM,IAAI,GAAoB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/C,MAAM,IAAI,EAAE,CAAC;IACb,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC;IAEjC,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;QACpC,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAqB,kBAAkB,CAAC,0CAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;KACnF;AACH,CAAC","sourcesContent":["import {PlatformContext} from \"@tsed/common\";\nimport {PlatformExceptions} from \"@tsed/platform-exceptions\";\n\n/**\n * @ignore\n * @param ctx\n * @param next\n */\nexport async function resourceNotFoundMiddleware(ctx: any, next: any) {\n const $ctx: PlatformContext = ctx.request.$ctx;\n await next();\n const status = ctx.status || 404;\n\n if (status === 404 && !$ctx.isDone()) {\n $ctx.injector.get<PlatformExceptions>(PlatformExceptions)?.resourceNotFound($ctx);\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Specify the behavior of the router controller.
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* @Controller("/")
|
|
6
|
-
* @CaseSensitive(true)
|
|
7
|
-
* class MyCtrl {
|
|
8
|
-
*
|
|
9
|
-
* }
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* Property | Description | Default
|
|
13
|
-
* ---|---|---
|
|
14
|
-
* CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
15
|
-
* Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
16
|
-
*
|
|
17
|
-
* @returns {Function}
|
|
18
|
-
* @decorator
|
|
19
|
-
* @koa
|
|
20
|
-
* @param sensitive
|
|
21
|
-
*/
|
|
22
|
-
export declare function CaseSensitive(sensitive: boolean): Function;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" />
|
|
2
|
-
import { RouterOptions } from "@koa/router";
|
|
3
|
-
/**
|
|
4
|
-
* Specify the behavior of the router controller.
|
|
5
|
-
*
|
|
6
|
-
* ```typescript
|
|
7
|
-
* @Controller("/")
|
|
8
|
-
* @RouterSettings({sensitive: true})
|
|
9
|
-
* class MyCtrl {
|
|
10
|
-
*
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* Property | Description | Default
|
|
15
|
-
* ---|---|---
|
|
16
|
-
* sensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
17
|
-
* strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
18
|
-
*
|
|
19
|
-
* @returns {(target:any)=>void}
|
|
20
|
-
* @decorator
|
|
21
|
-
* @param routerOptions
|
|
22
|
-
* @koa
|
|
23
|
-
*/
|
|
24
|
-
export declare function RouterSettings(routerOptions: RouterOptions): Function;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Specify the behavior of the router controller.
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* @Controller("/")
|
|
6
|
-
* @Strict(true)
|
|
7
|
-
* class MyCtrl {
|
|
8
|
-
*
|
|
9
|
-
* }
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* Property | Description | Default
|
|
13
|
-
* ---|---|---
|
|
14
|
-
* CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
|
|
15
|
-
* MergeParams | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. | false
|
|
16
|
-
* Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
|
|
17
|
-
*
|
|
18
|
-
* @param strict
|
|
19
|
-
* @returns {Function}
|
|
20
|
-
* @decorator
|
|
21
|
-
* @koa
|
|
22
|
-
*/
|
|
23
|
-
export declare function Strict(strict: boolean): Function;
|