@tsed/platform-express 7.0.0-beta.9 → 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.
Files changed (52) hide show
  1. package/coverage.json +6 -0
  2. package/jest.config.js +9 -0
  3. package/lib/cjs/components/PlatformExpress.js +67 -66
  4. package/lib/cjs/components/PlatformExpress.js.map +1 -1
  5. package/lib/cjs/index.js +0 -7
  6. package/lib/cjs/index.js.map +1 -1
  7. package/lib/cjs/interfaces/PlatformExpressSettings.js.map +1 -1
  8. package/lib/esm/components/PlatformExpress.js +67 -67
  9. package/lib/esm/components/PlatformExpress.js.map +1 -1
  10. package/lib/esm/index.js +0 -7
  11. package/lib/esm/index.js.map +1 -1
  12. package/lib/esm/interfaces/PlatformExpressSettings.js.map +1 -1
  13. package/lib/types/components/PlatformExpress.d.ts +12 -27
  14. package/lib/types/index.d.ts +0 -7
  15. package/lib/types/interfaces/PlatformExpressSettings.d.ts +4 -4
  16. package/package.json +28 -20
  17. package/readme.md +3 -2
  18. package/lib/cjs/decorators/caseSensitive.js +0 -31
  19. package/lib/cjs/decorators/caseSensitive.js.map +0 -1
  20. package/lib/cjs/decorators/mergeParams.js +0 -31
  21. package/lib/cjs/decorators/mergeParams.js.map +0 -1
  22. package/lib/cjs/decorators/routerSettings.js +0 -32
  23. package/lib/cjs/decorators/routerSettings.js.map +0 -1
  24. package/lib/cjs/decorators/strict.js +0 -31
  25. package/lib/cjs/decorators/strict.js.map +0 -1
  26. package/lib/cjs/services/PlatformExpressHandler.js +0 -31
  27. package/lib/cjs/services/PlatformExpressHandler.js.map +0 -1
  28. package/lib/cjs/services/PlatformExpressRequest.js +0 -12
  29. package/lib/cjs/services/PlatformExpressRequest.js.map +0 -1
  30. package/lib/cjs/services/PlatformExpressResponse.js +0 -12
  31. package/lib/cjs/services/PlatformExpressResponse.js.map +0 -1
  32. package/lib/esm/decorators/caseSensitive.js +0 -27
  33. package/lib/esm/decorators/caseSensitive.js.map +0 -1
  34. package/lib/esm/decorators/mergeParams.js +0 -27
  35. package/lib/esm/decorators/mergeParams.js.map +0 -1
  36. package/lib/esm/decorators/routerSettings.js +0 -28
  37. package/lib/esm/decorators/routerSettings.js.map +0 -1
  38. package/lib/esm/decorators/strict.js +0 -27
  39. package/lib/esm/decorators/strict.js.map +0 -1
  40. package/lib/esm/services/PlatformExpressHandler.js +0 -27
  41. package/lib/esm/services/PlatformExpressHandler.js.map +0 -1
  42. package/lib/esm/services/PlatformExpressRequest.js +0 -8
  43. package/lib/esm/services/PlatformExpressRequest.js.map +0 -1
  44. package/lib/esm/services/PlatformExpressResponse.js +0 -8
  45. package/lib/esm/services/PlatformExpressResponse.js.map +0 -1
  46. package/lib/types/decorators/caseSensitive.d.ts +0 -23
  47. package/lib/types/decorators/mergeParams.d.ts +0 -23
  48. package/lib/types/decorators/routerSettings.d.ts +0 -24
  49. package/lib/types/decorators/strict.d.ts +0 -23
  50. package/lib/types/services/PlatformExpressHandler.d.ts +0 -9
  51. package/lib/types/services/PlatformExpressRequest.d.ts +0 -8
  52. package/lib/types/services/PlatformExpressResponse.d.ts +0 -14
@@ -1,9 +1,7 @@
1
- import Express, { RouterOptions } from "express";
2
- import { InjectorService, PlatformAdapter, PlatformBuilder, PlatformContext, PlatformHandler, PlatformMulter, PlatformMulterSettings, PlatformRequest, PlatformResponse, PlatformStaticsOptions } from "@tsed/common";
1
+ import { InjectorService, PlatformAdapter, PlatformBuilder, PlatformContext, PlatformMulter, PlatformMulterSettings, PlatformStaticsOptions } from "@tsed/common";
3
2
  import { Type } from "@tsed/core";
4
- import { PlatformExpressHandler } from "../services/PlatformExpressHandler";
5
- import { PlatformExpressResponse } from "../services/PlatformExpressResponse";
6
- import { PlatformExpressRequest } from "../services/PlatformExpressRequest";
3
+ import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
4
+ import Express from "express";
7
5
  import { PlatformExpressStaticsOptions } from "../interfaces/PlatformExpressStaticsOptions";
8
6
  declare module "express" {
9
7
  interface Request {
@@ -13,8 +11,6 @@ declare module "express" {
13
11
  }
14
12
  declare global {
15
13
  namespace TsED {
16
- interface Router extends Express.Router {
17
- }
18
14
  interface Application extends Express.Application {
19
15
  }
20
16
  interface StaticsOptions extends PlatformExpressStaticsOptions {
@@ -29,47 +25,36 @@ declare global {
29
25
  * @platform
30
26
  * @express
31
27
  */
32
- export declare class PlatformExpress implements PlatformAdapter<Express.Application, Express.Router> {
28
+ export declare class PlatformExpress implements PlatformAdapter<Express.Application> {
33
29
  #private;
34
30
  protected injector: InjectorService;
35
- readonly providers: ({
36
- provide: typeof PlatformHandler;
37
- useClass: typeof PlatformExpressHandler;
38
- } | {
39
- provide: typeof PlatformResponse;
40
- useClass: typeof PlatformExpressResponse;
41
- } | {
42
- provide: typeof PlatformRequest;
43
- useClass: typeof PlatformExpressRequest;
44
- })[];
31
+ readonly providers: never[];
45
32
  constructor(injector: InjectorService);
46
33
  /**
47
34
  * Create new serverless application. In this mode, the component scan are disabled.
48
35
  * @param module
49
36
  * @param settings
50
37
  */
51
- static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<Express.Application, Express.Router>;
38
+ static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<Express.Application>;
52
39
  /**
53
40
  * Bootstrap a server application
54
41
  * @param module
55
42
  * @param settings
56
43
  */
57
- static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<Express.Application, Express.Router>>;
44
+ static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<Express.Application>>;
58
45
  onInit(): void;
59
- useRouter(): this;
60
46
  beforeLoadRoutes(): Promise<void>;
61
47
  afterLoadRoutes(): Promise<void>;
48
+ mapLayers(layers: PlatformLayer[]): void;
49
+ mapHandler(handler: Function, metadata: PlatformHandlerMetadata): Function;
62
50
  useContext(): this;
63
- multipart(options: PlatformMulterSettings): PlatformMulter;
64
51
  app(): {
65
52
  app: any;
66
- callback(): any;
67
- };
68
- router(routerOptions?: Partial<RouterOptions>): {
69
- router: import("express-serve-static-core").Router;
70
- callback(): import("express-serve-static-core").Router;
53
+ callback: () => any;
71
54
  };
55
+ multipart(options: PlatformMulterSettings): PlatformMulter;
72
56
  statics(endpoint: string, options: PlatformStaticsOptions): (request: any, response: any, next: any) => void;
73
57
  bodyParser(type: "json" | "raw" | "text" | "urlencoded", additionalOptions?: any): any;
58
+ private getPlatformApplication;
74
59
  private configureViewsEngine;
75
60
  }
@@ -3,14 +3,7 @@
3
3
  */
4
4
  export * from "./exports";
5
5
  export * from "./components/PlatformExpress";
6
- export * from "./decorators/caseSensitive";
7
- export * from "./decorators/mergeParams";
8
- export * from "./decorators/routerSettings";
9
- export * from "./decorators/strict";
10
6
  export * from "./interfaces/PlatformExpressSettings";
11
7
  export * from "./interfaces/PlatformExpressStaticsOptions";
12
8
  export * from "./interfaces/interfaces";
13
9
  export * from "./middlewares/staticsMiddleware";
14
- export * from "./services/PlatformExpressHandler";
15
- export * from "./services/PlatformExpressRequest";
16
- export * from "./services/PlatformExpressResponse";
@@ -15,9 +15,9 @@ export interface PlatformExpressSettings {
15
15
  * body parser configuration
16
16
  */
17
17
  bodyParser?: {
18
- json?: (opts?: OptionsJson) => NextHandleFunction | OptionsJson;
19
- text?: (opts?: OptionsText) => NextHandleFunction | OptionsText;
20
- raw?: (opts?: Options) => NextHandleFunction | Options;
21
- urlencoded?: (opts?: OptionsUrlencoded) => NextHandleFunction | OptionsUrlencoded;
18
+ json?: ((opts?: OptionsJson) => NextHandleFunction) | OptionsJson;
19
+ text?: ((opts?: OptionsText) => NextHandleFunction) | OptionsText;
20
+ raw?: ((opts?: Options) => NextHandleFunction) | Options;
21
+ urlencoded?: ((opts?: OptionsUrlencoded) => NextHandleFunction) | OptionsUrlencoded;
22
22
  };
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-express",
3
- "version": "7.0.0-beta.9",
3
+ "version": "7.0.0-rc.1",
4
4
  "description": "A TypeScript Framework on top of Express",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -19,7 +19,8 @@
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
21
  "start": "ts-node -r tsconfig-paths/register test/app/index.ts",
22
- "start:emulate": "ts-node -r tsconfig-paths/register test/app/emulate.ts"
22
+ "start:emulate": "ts-node -r tsconfig-paths/register test/app/emulate.ts",
23
+ "test": "cross-env NODE_ENV=test yarn jest --max-workers=2 --testTimeout 10000"
23
24
  },
24
25
  "keywords": [
25
26
  "Express",
@@ -48,19 +49,19 @@
48
49
  "bugs": {
49
50
  "url": "https://github.com/tsedio/tsed/issues"
50
51
  },
51
- "homepage": "https://github.com/tsedio/tsed/tree/beta/packages/platform/platform-express",
52
+ "homepage": "https://github.com/tsedio/tsed/tree/rc/packages/platform/platform-express",
52
53
  "repository": "https://github.com/tsedio/tsed",
53
54
  "dependencies": {
54
- "express": "^4.17.1",
55
- "multer": "^1.4.2",
56
- "tslib": "2.3.1"
55
+ "express": "^4.18.1",
56
+ "multer": "^1.4.5-lts.1",
57
+ "tslib": "2.4.0"
57
58
  },
58
59
  "devDependencies": {
59
- "@tsed/common": "7.0.0-beta.9",
60
- "@tsed/core": "7.0.0-beta.9",
61
- "@tsed/di": "7.0.0-beta.9",
62
- "@tsed/platform-test-utils": "7.0.0-beta.9",
63
- "@tsed/platform-views": "7.0.0-beta.9",
60
+ "@tsed/common": "7.0.0-rc.1",
61
+ "@tsed/core": "7.0.0-rc.1",
62
+ "@tsed/di": "7.0.0-rc.1",
63
+ "@tsed/platform-test-utils": "7.0.0-rc.1",
64
+ "@tsed/platform-views": "7.0.0-rc.1",
64
65
  "@types/body-parser": "1.19.2",
65
66
  "@types/compression": "1.7.2",
66
67
  "@types/cookie-parser": "1.4.2",
@@ -76,16 +77,17 @@
76
77
  "method-override": "3.0.0"
77
78
  },
78
79
  "peerDependencies": {
79
- "@tsed/common": "^7.0.0-beta.9",
80
- "@tsed/core": "^7.0.0-beta.9",
81
- "@tsed/di": "^7.0.0-beta.9",
82
- "@tsed/json-mapper": "^7.0.0-beta.9",
83
- "@tsed/logger": ">=6.1.1",
84
- "@tsed/openspec": "^7.0.0-beta.9",
85
- "@tsed/platform-views": "^7.0.0-beta.9",
86
- "@tsed/schema": "^7.0.0-beta.9",
80
+ "@tsed/common": "^7.0.0-rc.1",
81
+ "@tsed/core": "^7.0.0-rc.1",
82
+ "@tsed/di": "^7.0.0-rc.1",
83
+ "@tsed/json-mapper": "^7.0.0-rc.1",
84
+ "@tsed/logger": ">=6.2.0",
85
+ "@tsed/openspec": "^7.0.0-rc.1",
86
+ "@tsed/platform-views": "^7.0.0-rc.1",
87
+ "@tsed/schema": "^7.0.0-rc.1",
87
88
  "@types/multer": "^1.4.5",
88
- "body-parser": "1.19.0"
89
+ "body-parser": "^1.19.0",
90
+ "multer": "^1.4.5-lts.1"
89
91
  },
90
92
  "peerDependenciesMeta": {
91
93
  "@tsed/common": {
@@ -111,6 +113,12 @@
111
113
  },
112
114
  "@tsed/logger": {
113
115
  "optional": false
116
+ },
117
+ "multer": {
118
+ "optional": false
114
119
  }
120
+ },
121
+ "publishConfig": {
122
+ "tag": "rc"
115
123
  }
116
124
  }
package/readme.md CHANGED
@@ -11,7 +11,8 @@
11
11
  [![npm version](https://badge.fury.io/js/%40tsed%2Fcommon.svg)](https://badge.fury.io/js/%40tsed%2Fcommon)
12
12
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
13
13
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
14
- [![backers](https://opencollective.com/tsed/tiers/badge.svg)](https://opencollective.com/tsed)
14
+ [![github](https://img.shields.io/static/v1?label=Github%20sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/romakita)
15
+ [![opencollective](https://img.shields.io/static/v1?label=OpenCollective%20sponsor&message=%E2%9D%A4&logo=OpenCollective&color=%23fe8e86)](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 - 2018 Romain Lenzotti
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,31 +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
- * 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 caseSensitive
23
- * @returns {Function}
24
- * @decorator
25
- * @express
26
- */
27
- function CaseSensitive(caseSensitive) {
28
- return (0, routerSettings_1.RouterSettings)({ caseSensitive });
29
- }
30
- exports.CaseSensitive = CaseSensitive;
31
- //# sourceMappingURL=caseSensitive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"caseSensitive.js","sourceRoot":"","sources":["../../../src/decorators/caseSensitive.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,aAAa,CAAC,aAAsB;IAClD,OAAO,IAAA,+BAAc,EAAC,EAAC,aAAa,EAAC,CAAC,CAAC;AACzC,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 * 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 caseSensitive\n * @returns {Function}\n * @decorator\n * @express\n */\nexport function CaseSensitive(caseSensitive: boolean) {\n return RouterSettings({caseSensitive});\n}\n"]}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MergeParams = void 0;
4
- const routerSettings_1 = require("./routerSettings");
5
- /**
6
- * Specify the behavior of the router controller.
7
- *
8
- * ```typescript
9
- * @Controller("/")
10
- * @MergeParams(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 mergeParams
23
- * @returns {Function}
24
- * @decorator
25
- * @express
26
- */
27
- function MergeParams(mergeParams = true) {
28
- return (0, routerSettings_1.RouterSettings)({ mergeParams });
29
- }
30
- exports.MergeParams = MergeParams;
31
- //# sourceMappingURL=mergeParams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeParams.js","sourceRoot":"","sources":["../../../src/decorators/mergeParams.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,WAAW,CAAC,cAAuB,IAAI;IACrD,OAAO,IAAA,+BAAc,EAAC,EAAC,WAAW,EAAC,CAAC,CAAC;AACvC,CAAC;AAFD,kCAEC","sourcesContent":["import {RouterSettings} from \"./routerSettings\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @MergeParams(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 mergeParams\n * @returns {Function}\n * @decorator\n * @express\n */\nexport function MergeParams(mergeParams: boolean = true) {\n return RouterSettings({mergeParams});\n}\n"]}
@@ -1,32 +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({mergeParams: true})
12
- * class MyCtrl {
13
- *
14
- * }
15
- * ```
16
- *
17
- * Property | Description | Default
18
- * ---|---|---
19
- * caseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
20
- * 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
21
- * strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
22
- *
23
- * @returns {(target:any)=>void}
24
- * @decorator
25
- * @param routerOptions
26
- * @express
27
- */
28
- function RouterSettings(routerOptions) {
29
- return (0, core_1.StoreMerge)(common_1.ROUTER_OPTIONS, routerOptions);
30
- }
31
- exports.RouterSettings = RouterSettings;
32
- //# 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;;;;;;;;;;;;;;;;;;;;;GAqBG;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 \"express\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @RouterSettings({mergeParams: 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 * @returns {(target:any)=>void}\n * @decorator\n * @param routerOptions\n * @express\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
- * @express
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 * @express\n */\nexport function Strict(strict: boolean) {\n return RouterSettings({strict});\n}\n"]}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformExpressHandler = void 0;
4
- const common_1 = require("@tsed/common");
5
- /**
6
- * @platform
7
- * @express
8
- */
9
- class PlatformExpressHandler extends common_1.PlatformHandler {
10
- createRawHandler(metadata) {
11
- if (metadata.type === common_1.HandlerType.ERR_MIDDLEWARE) {
12
- const handler = this.compileHandler(metadata);
13
- return async (err, req, res, next) => handler({
14
- err,
15
- next,
16
- $ctx: req.$ctx
17
- });
18
- }
19
- return super.createRawHandler(metadata);
20
- }
21
- async onCtxRequest(requestOptions) {
22
- try {
23
- return await super.onCtxRequest(requestOptions);
24
- }
25
- catch (er) {
26
- return this.onError(er, requestOptions);
27
- }
28
- }
29
- }
30
- exports.PlatformExpressHandler = PlatformExpressHandler;
31
- //# sourceMappingURL=PlatformExpressHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformExpressHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressHandler.ts"],"names":[],"mappings":";;;AAAA,yCAA6F;AAE7F;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,wBAAe;IAC/C,gBAAgB,CAAC,QAAyB;QAClD,IAAI,QAAQ,CAAC,IAAI,KAAK,oBAAW,CAAC,cAAc,EAAE;YAChD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC9C,OAAO,KAAK,EAAE,GAAQ,EAAE,GAAQ,EAAE,GAAQ,EAAE,IAAS,EAAE,EAAE,CACvD,OAAO,CAAC;gBACN,GAAG;gBACH,IAAI;gBACJ,IAAI,EAAE,GAAG,CAAC,IAAI;aACf,CAAC,CAAC;SACN;QAED,OAAO,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,cAAgC;QAC3D,IAAI;YACF,OAAO,MAAM,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;SACjD;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;SACzC;IACH,CAAC;CACF;AAtBD,wDAsBC","sourcesContent":["import {HandlerMetadata, HandlerType, OnRequestOptions, PlatformHandler} from \"@tsed/common\";\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressHandler extends PlatformHandler {\n protected createRawHandler(metadata: HandlerMetadata): Function {\n if (metadata.type === HandlerType.ERR_MIDDLEWARE) {\n const handler = this.compileHandler(metadata);\n return async (err: any, req: any, res: any, next: any) =>\n handler({\n err,\n next,\n $ctx: req.$ctx\n });\n }\n\n return super.createRawHandler(metadata);\n }\n\n protected async onCtxRequest(requestOptions: OnRequestOptions): Promise<any> {\n try {\n return await super.onCtxRequest(requestOptions);\n } catch (er) {\n return this.onError(er, requestOptions);\n }\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformExpressRequest = void 0;
4
- const common_1 = require("@tsed/common");
5
- /**
6
- * @platform
7
- * @express
8
- */
9
- class PlatformExpressRequest extends common_1.PlatformRequest {
10
- }
11
- exports.PlatformExpressRequest = PlatformExpressRequest;
12
- //# sourceMappingURL=PlatformExpressRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformExpressRequest.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressRequest.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;AAG9D;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,wBAAgC;CAAG;AAA/E,wDAA+E","sourcesContent":["import {PlatformContext, PlatformRequest} from \"@tsed/common\";\nimport type Express from \"express\";\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressRequest extends PlatformRequest<Express.Request> {}\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformExpressResponse = void 0;
4
- const common_1 = require("@tsed/common");
5
- /**
6
- * @platform
7
- * @express
8
- */
9
- class PlatformExpressResponse extends common_1.PlatformResponse {
10
- }
11
- exports.PlatformExpressResponse = PlatformExpressResponse;
12
- //# sourceMappingURL=PlatformExpressResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformExpressResponse.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressResponse.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAS9C;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,yBAAkC;CAAG;AAAlF,0DAAkF","sourcesContent":["import {PlatformResponse} from \"@tsed/common\";\nimport type Express from \"express\";\n\ndeclare global {\n namespace TsED {\n export interface Response extends Express.Response {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressResponse extends PlatformResponse<Express.Response> {}\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
- * @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
- * 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 caseSensitive
20
- * @returns {Function}
21
- * @decorator
22
- * @express
23
- */
24
- export function CaseSensitive(caseSensitive) {
25
- return RouterSettings({ caseSensitive });
26
- }
27
- //# 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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,aAAa,CAAC,aAAsB;IAClD,OAAO,cAAc,CAAC,EAAC,aAAa,EAAC,CAAC,CAAC;AACzC,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 * 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 caseSensitive\n * @returns {Function}\n * @decorator\n * @express\n */\nexport function CaseSensitive(caseSensitive: boolean) {\n return RouterSettings({caseSensitive});\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
- * @MergeParams(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 mergeParams
20
- * @returns {Function}
21
- * @decorator
22
- * @express
23
- */
24
- export function MergeParams(mergeParams = true) {
25
- return RouterSettings({ mergeParams });
26
- }
27
- //# sourceMappingURL=mergeParams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeParams.js","sourceRoot":"","sources":["../../../src/decorators/mergeParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,WAAW,CAAC,cAAuB,IAAI;IACrD,OAAO,cAAc,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {RouterSettings} from \"./routerSettings\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @MergeParams(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 mergeParams\n * @returns {Function}\n * @decorator\n * @express\n */\nexport function MergeParams(mergeParams: boolean = true) {\n return RouterSettings({mergeParams});\n}\n"]}
@@ -1,28 +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({mergeParams: true})
9
- * class MyCtrl {
10
- *
11
- * }
12
- * ```
13
- *
14
- * Property | Description | Default
15
- * ---|---|---
16
- * caseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
17
- * 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
18
- * strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
19
- *
20
- * @returns {(target:any)=>void}
21
- * @decorator
22
- * @param routerOptions
23
- * @express
24
- */
25
- export function RouterSettings(routerOptions) {
26
- return StoreMerge(ROUTER_OPTIONS, routerOptions);
27
- }
28
- //# 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;;;;;;;;;;;;;;;;;;;;;GAqBG;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 \"express\";\n\n/**\n * Specify the behavior of the router controller.\n *\n * ```typescript\n * @Controller(\"/\")\n * @RouterSettings({mergeParams: 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 * @returns {(target:any)=>void}\n * @decorator\n * @param routerOptions\n * @express\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
- * @express
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 * @express\n */\nexport function Strict(strict: boolean) {\n return RouterSettings({strict});\n}\n"]}
@@ -1,27 +0,0 @@
1
- import { HandlerType, PlatformHandler } from "@tsed/common";
2
- /**
3
- * @platform
4
- * @express
5
- */
6
- export class PlatformExpressHandler extends PlatformHandler {
7
- createRawHandler(metadata) {
8
- if (metadata.type === HandlerType.ERR_MIDDLEWARE) {
9
- const handler = this.compileHandler(metadata);
10
- return async (err, req, res, next) => handler({
11
- err,
12
- next,
13
- $ctx: req.$ctx
14
- });
15
- }
16
- return super.createRawHandler(metadata);
17
- }
18
- async onCtxRequest(requestOptions) {
19
- try {
20
- return await super.onCtxRequest(requestOptions);
21
- }
22
- catch (er) {
23
- return this.onError(er, requestOptions);
24
- }
25
- }
26
- }
27
- //# sourceMappingURL=PlatformExpressHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformExpressHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAoB,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7F;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IAC/C,gBAAgB,CAAC,QAAyB;QAClD,IAAI,QAAQ,CAAC,IAAI,KAAK,WAAW,CAAC,cAAc,EAAE;YAChD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC9C,OAAO,KAAK,EAAE,GAAQ,EAAE,GAAQ,EAAE,GAAQ,EAAE,IAAS,EAAE,EAAE,CACvD,OAAO,CAAC;gBACN,GAAG;gBACH,IAAI;gBACJ,IAAI,EAAE,GAAG,CAAC,IAAI;aACf,CAAC,CAAC;SACN;QAED,OAAO,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,cAAgC;QAC3D,IAAI;YACF,OAAO,MAAM,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;SACjD;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;SACzC;IACH,CAAC;CACF","sourcesContent":["import {HandlerMetadata, HandlerType, OnRequestOptions, PlatformHandler} from \"@tsed/common\";\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressHandler extends PlatformHandler {\n protected createRawHandler(metadata: HandlerMetadata): Function {\n if (metadata.type === HandlerType.ERR_MIDDLEWARE) {\n const handler = this.compileHandler(metadata);\n return async (err: any, req: any, res: any, next: any) =>\n handler({\n err,\n next,\n $ctx: req.$ctx\n });\n }\n\n return super.createRawHandler(metadata);\n }\n\n protected async onCtxRequest(requestOptions: OnRequestOptions): Promise<any> {\n try {\n return await super.onCtxRequest(requestOptions);\n } catch (er) {\n return this.onError(er, requestOptions);\n }\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { PlatformRequest } from "@tsed/common";
2
- /**
3
- * @platform
4
- * @express
5
- */
6
- export class PlatformExpressRequest extends PlatformRequest {
7
- }
8
- //# sourceMappingURL=PlatformExpressRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformExpressRequest.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,eAAe,EAAC,MAAM,cAAc,CAAC;AAG9D;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,eAAgC;CAAG","sourcesContent":["import {PlatformContext, PlatformRequest} from \"@tsed/common\";\nimport type Express from \"express\";\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressRequest extends PlatformRequest<Express.Request> {}\n"]}
@@ -1,8 +0,0 @@
1
- import { PlatformResponse } from "@tsed/common";
2
- /**
3
- * @platform
4
- * @express
5
- */
6
- export class PlatformExpressResponse extends PlatformResponse {
7
- }
8
- //# sourceMappingURL=PlatformExpressResponse.js.map