@tsed/platform-express 7.0.0-beta.2 → 7.0.0-beta.20

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 (96) hide show
  1. package/coverage.json +6 -0
  2. package/jest.config.js +9 -0
  3. package/lib/cjs/components/PlatformExpress.js +126 -66
  4. package/lib/cjs/components/PlatformExpress.js.map +1 -1
  5. package/lib/cjs/exports.js +7 -0
  6. package/lib/cjs/exports.js.map +1 -0
  7. package/lib/cjs/index.js +9 -12
  8. package/lib/cjs/index.js.map +1 -1
  9. package/lib/cjs/interfaces/PlatformExpressSettings.js.map +1 -1
  10. package/lib/cjs/interfaces/interfaces.js +3 -0
  11. package/lib/cjs/interfaces/interfaces.js.map +1 -0
  12. package/lib/cjs/middlewares/staticsMiddleware.js +1 -1
  13. package/lib/cjs/middlewares/staticsMiddleware.js.map +1 -1
  14. package/lib/cjs/package.json +3 -0
  15. package/lib/esm/components/PlatformExpress.js +126 -48
  16. package/lib/esm/components/PlatformExpress.js.map +1 -1
  17. package/lib/esm/exports.js +5 -0
  18. package/lib/esm/exports.js.map +1 -0
  19. package/lib/esm/index.js +9 -12
  20. package/lib/esm/index.js.map +1 -1
  21. package/lib/esm/interfaces/PlatformExpressSettings.js.map +1 -1
  22. package/lib/esm/interfaces/interfaces.js +2 -0
  23. package/lib/esm/interfaces/interfaces.js.map +1 -0
  24. package/lib/esm/package.json +3 -0
  25. package/lib/types/components/PlatformExpress.d.ts +40 -22
  26. package/lib/types/exports.d.ts +1 -0
  27. package/lib/types/index.d.ts +8 -3
  28. package/lib/types/interfaces/PlatformExpressSettings.d.ts +15 -1
  29. package/lib/types/interfaces/{index.d.ts → interfaces.d.ts} +6 -4
  30. package/package.json +64 -26
  31. package/readme.md +3 -4
  32. package/tsconfig.compile.esm.json +1 -12
  33. package/lib/cjs/decorators/caseSensitive.js +0 -31
  34. package/lib/cjs/decorators/caseSensitive.js.map +0 -1
  35. package/lib/cjs/decorators/index.js +0 -8
  36. package/lib/cjs/decorators/index.js.map +0 -1
  37. package/lib/cjs/decorators/mergeParams.js +0 -31
  38. package/lib/cjs/decorators/mergeParams.js.map +0 -1
  39. package/lib/cjs/decorators/routerSettings.js +0 -32
  40. package/lib/cjs/decorators/routerSettings.js.map +0 -1
  41. package/lib/cjs/decorators/strict.js +0 -31
  42. package/lib/cjs/decorators/strict.js.map +0 -1
  43. package/lib/cjs/interfaces/index.js +0 -6
  44. package/lib/cjs/interfaces/index.js.map +0 -1
  45. package/lib/cjs/middlewares/rawBodyMiddleware.js +0 -27
  46. package/lib/cjs/middlewares/rawBodyMiddleware.js.map +0 -1
  47. package/lib/cjs/services/PlatformExpressApplication.js +0 -32
  48. package/lib/cjs/services/PlatformExpressApplication.js.map +0 -1
  49. package/lib/cjs/services/PlatformExpressHandler.js +0 -31
  50. package/lib/cjs/services/PlatformExpressHandler.js.map +0 -1
  51. package/lib/cjs/services/PlatformExpressRequest.js +0 -12
  52. package/lib/cjs/services/PlatformExpressRequest.js.map +0 -1
  53. package/lib/cjs/services/PlatformExpressResponse.js +0 -12
  54. package/lib/cjs/services/PlatformExpressResponse.js.map +0 -1
  55. package/lib/cjs/services/PlatformExpressRouter.js +0 -34
  56. package/lib/cjs/services/PlatformExpressRouter.js.map +0 -1
  57. package/lib/cjs/services/index.js +0 -9
  58. package/lib/cjs/services/index.js.map +0 -1
  59. package/lib/esm/decorators/caseSensitive.js +0 -27
  60. package/lib/esm/decorators/caseSensitive.js.map +0 -1
  61. package/lib/esm/decorators/index.js +0 -5
  62. package/lib/esm/decorators/index.js.map +0 -1
  63. package/lib/esm/decorators/mergeParams.js +0 -27
  64. package/lib/esm/decorators/mergeParams.js.map +0 -1
  65. package/lib/esm/decorators/routerSettings.js +0 -28
  66. package/lib/esm/decorators/routerSettings.js.map +0 -1
  67. package/lib/esm/decorators/strict.js +0 -27
  68. package/lib/esm/decorators/strict.js.map +0 -1
  69. package/lib/esm/interfaces/index.js +0 -3
  70. package/lib/esm/interfaces/index.js.map +0 -1
  71. package/lib/esm/middlewares/rawBodyMiddleware.js +0 -22
  72. package/lib/esm/middlewares/rawBodyMiddleware.js.map +0 -1
  73. package/lib/esm/services/PlatformExpressApplication.js +0 -29
  74. package/lib/esm/services/PlatformExpressApplication.js.map +0 -1
  75. package/lib/esm/services/PlatformExpressHandler.js +0 -27
  76. package/lib/esm/services/PlatformExpressHandler.js.map +0 -1
  77. package/lib/esm/services/PlatformExpressRequest.js +0 -8
  78. package/lib/esm/services/PlatformExpressRequest.js.map +0 -1
  79. package/lib/esm/services/PlatformExpressResponse.js +0 -8
  80. package/lib/esm/services/PlatformExpressResponse.js.map +0 -1
  81. package/lib/esm/services/PlatformExpressRouter.js +0 -31
  82. package/lib/esm/services/PlatformExpressRouter.js.map +0 -1
  83. package/lib/esm/services/index.js +0 -6
  84. package/lib/esm/services/index.js.map +0 -1
  85. package/lib/types/decorators/caseSensitive.d.ts +0 -23
  86. package/lib/types/decorators/index.d.ts +0 -4
  87. package/lib/types/decorators/mergeParams.d.ts +0 -23
  88. package/lib/types/decorators/routerSettings.d.ts +0 -24
  89. package/lib/types/decorators/strict.d.ts +0 -23
  90. package/lib/types/middlewares/rawBodyMiddleware.d.ts +0 -4
  91. package/lib/types/services/PlatformExpressApplication.d.ts +0 -24
  92. package/lib/types/services/PlatformExpressHandler.d.ts +0 -9
  93. package/lib/types/services/PlatformExpressRequest.d.ts +0 -22
  94. package/lib/types/services/PlatformExpressResponse.d.ts +0 -14
  95. package/lib/types/services/PlatformExpressRouter.d.ts +0 -18
  96. package/lib/types/services/index.d.ts +0 -5
@@ -1,24 +0,0 @@
1
- import { RouterOptions } from "express";
2
- /**
3
- * Specify the behavior of the router controller.
4
- *
5
- * ```typescript
6
- * @Controller("/")
7
- * @RouterSettings({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
- * @returns {(target:any)=>void}
20
- * @decorator
21
- * @param routerOptions
22
- * @express
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
- * @express
22
- */
23
- export declare function Strict(strict: boolean): Function;
@@ -1,4 +0,0 @@
1
- import { Request } from "express";
2
- export declare function rawBodyMiddleware(request: Request & {
3
- rawBody: string;
4
- }, response: any, next: any): void;
@@ -1,24 +0,0 @@
1
- import { Configuration, PlatformApplication, PlatformHandler } from "@tsed/common";
2
- import Express from "express";
3
- import { PlatformExpressStaticsOptions } from "../interfaces/PlatformExpressStaticsOptions";
4
- import { PlatformExpressRouter } from "./PlatformExpressRouter";
5
- declare global {
6
- namespace TsED {
7
- interface Application extends Express.Application {
8
- }
9
- interface StaticsOptions extends PlatformExpressStaticsOptions {
10
- }
11
- }
12
- }
13
- /**
14
- * @platform
15
- * @express
16
- */
17
- export declare class PlatformExpressApplication extends PlatformExpressRouter implements PlatformApplication<Express.Application, Express.Router> {
18
- app: Express.Application;
19
- rawApp: Express.Application;
20
- rawRouter: Express.Router;
21
- constructor(platformHandler: PlatformHandler, configuration: Configuration);
22
- getApp(): Express.Application;
23
- callback(): Express.Application;
24
- }
@@ -1,9 +0,0 @@
1
- import { HandlerMetadata, OnRequestOptions, PlatformHandler } from "@tsed/common";
2
- /**
3
- * @platform
4
- * @express
5
- */
6
- export declare class PlatformExpressHandler extends PlatformHandler {
7
- protected createRawHandler(metadata: HandlerMetadata): Function;
8
- protected onCtxRequest(requestOptions: OnRequestOptions): Promise<any>;
9
- }
@@ -1,22 +0,0 @@
1
- import { PlatformContext, PlatformRequest } from "@tsed/common";
2
- import type Express from "express";
3
- declare module "express" {
4
- interface Request {
5
- id: string;
6
- $ctx: PlatformContext;
7
- }
8
- }
9
- declare global {
10
- namespace TsED {
11
- interface Request extends Express.Request {
12
- id: string;
13
- $ctx: PlatformContext;
14
- }
15
- }
16
- }
17
- /**
18
- * @platform
19
- * @express
20
- */
21
- export declare class PlatformExpressRequest extends PlatformRequest<Express.Request> {
22
- }
@@ -1,14 +0,0 @@
1
- import { PlatformResponse } from "@tsed/common";
2
- import type Express from "express";
3
- declare global {
4
- namespace TsED {
5
- interface Response extends Express.Response {
6
- }
7
- }
8
- }
9
- /**
10
- * @platform
11
- * @express
12
- */
13
- export declare class PlatformExpressResponse extends PlatformResponse<Express.Response> {
14
- }
@@ -1,18 +0,0 @@
1
- import { PlatformHandler, PlatformRouter, PlatformStaticsOptions } from "@tsed/common";
2
- import { Configuration } from "@tsed/di";
3
- import Express from "express";
4
- import { RouterOptions } from "express";
5
- declare global {
6
- namespace TsED {
7
- interface Router extends Express.Router {
8
- }
9
- }
10
- }
11
- /**
12
- * @platform
13
- * @express
14
- */
15
- export declare class PlatformExpressRouter extends PlatformRouter<Express.Router> {
16
- constructor(platform: PlatformHandler, configuration: Configuration, routerOptions?: Partial<RouterOptions>);
17
- statics(endpoint: string, options: PlatformStaticsOptions): this;
18
- }
@@ -1,5 +0,0 @@
1
- export * from "./PlatformExpressApplication";
2
- export * from "./PlatformExpressHandler";
3
- export * from "./PlatformExpressResponse";
4
- export * from "./PlatformExpressRequest";
5
- export * from "./PlatformExpressRouter";