@tsed/common 6.70.1 → 7.0.0-alpha.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.
@@ -2,8 +2,6 @@ import { Type } from "@tsed/core";
2
2
  import { Container, InjectorService, IProvider } from "@tsed/di";
3
3
  import { Platform } from "../services/Platform";
4
4
  import { PlatformApplication } from "../services/PlatformApplication";
5
- import { PlatformRequest } from "../services/PlatformRequest";
6
- import { PlatformResponse } from "../services/PlatformResponse";
7
5
  /**
8
6
  * @ignore
9
7
  */
@@ -94,8 +92,6 @@ export declare abstract class PlatformBuilder<App = TsED.Application, Router = T
94
92
  loadStatics(): Promise<void>;
95
93
  useProvider(token: Type<any>, settings?: Partial<IProvider>): this;
96
94
  protected importProviders(): Promise<void>;
97
- protected createRequest(req: any): PlatformRequest;
98
- protected createResponse(res: any): PlatformResponse;
99
95
  /**
100
96
  * Load middlewares from configuration for the given hook
101
97
  * @param hook
@@ -7,10 +7,8 @@ export * from "./method/location";
7
7
  export * from "./method/redirect";
8
8
  export * from "./method/endpointFn";
9
9
  export * from "./class/controller";
10
- export * from "./params/responseData";
11
10
  export * from "./params/response";
12
11
  export * from "./params/request";
13
12
  export * from "./params/next";
14
13
  export * from "./params/error";
15
- export * from "./params/endpointInfo";
16
14
  export * from "../utils/mapReturnedResponse";
@@ -1,20 +1 @@
1
- /**
2
- * Sets the response Location HTTP header to the specified path parameter.
3
- *
4
- * ```typescript
5
- * @Location('/foo/bar')
6
- * @Location('http://example.com')
7
- * @Location('back')
8
- * private myMethod() {
9
- *
10
- * }
11
- * ```
12
- *
13
- * A path value of “back” has a special meaning, it refers to the URL specified in the `Referer` header of the request. If the `Referer` header was not specified, it refers to “/”.
14
- *
15
- * @param location
16
- * @returns {Function}
17
- * @decorator
18
- * @operation
19
- */
20
- export declare function Location(location: string): Function;
1
+ export { Location } from "@tsed/schema";
@@ -1,50 +1 @@
1
- /**
2
- * Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.
3
- *
4
- * ```typescript
5
- * @Redirect('/foo/bar')
6
- * @Redirect(301, 'http://example.com')
7
- * private myMethod() {}
8
- * ```
9
- * Redirects can be a fully-qualified URL for redirecting to a different site:
10
- *
11
- * ```typescript
12
- * @Redirect('http://google.com');
13
- * private myMethod() {}
14
- * ```
15
- *
16
- * Redirects can be relative to the root of the host name. For example, if the application is on http://example.com/admin/post/new, the following would redirect to the URL http://example.com/admin:
17
- *
18
- * ```typescript
19
- * @Redirect('/admin');
20
- * ```
21
- * Redirects can be relative to the current URL. For example, from http://example.com/blog/admin/ (notice the trailing slash), the following would redirect to the URL http://example.com/blog/admin/post/new.
22
- *
23
- * ```typescript
24
- * @Redirect('post/new');
25
- * ```
26
- *
27
- * Redirecting to post/new from http://example.com/blog/admin (no trailing slash), will redirect to http://example.com/blog/post/new.
28
- *
29
- * If you found the above behavior confusing, think of path segments as directories (with trailing slashes) and files, it will start to make sense.
30
- *
31
- * Path-relative redirects are also possible. If you were on http://example.com/admin/post/new, the following would redirect to http//example.com/admin/post:
32
- *
33
- * ```typescript
34
- * @Redirect('..');
35
- * ``
36
- *
37
- * A back redirection redirects the request back to the referer, defaulting to / when the referer is missing.
38
- *
39
- * ```typescript
40
- * @Redirect('back');
41
- * ```
42
- *
43
- * @param url
44
- * @decorator
45
- * @operation
46
- * @response
47
- * @headers
48
- */
49
- export declare function Redirect(url: string): Function;
50
- export declare function Redirect(status: number, url: string): Function;
1
+ export { Redirect } from "@tsed/schema";
@@ -45,12 +45,8 @@ export declare class EndpointMetadata extends JsonEntityStore implements Endpoin
45
45
  get operationPaths(): Map<string, import("@tsed/schema").JsonMethodPath>;
46
46
  get view(): EndpointViewOptions;
47
47
  set view(view: EndpointViewOptions);
48
- get location(): string;
49
- set location(url: string);
50
48
  get acceptMimes(): string[];
51
49
  set acceptMimes(mimes: string[]);
52
- get redirect(): EndpointRedirectOptions;
53
- set redirect(options: EndpointRedirectOptions);
54
50
  /**
55
51
  * Get all endpoints from a given class and his parents.
56
52
  * @param {Type<any>} target
@@ -12,10 +12,11 @@ declare global {
12
12
  }
13
13
  }
14
14
  export interface PlatformContextOptions extends DIContextOptions {
15
- url: string;
15
+ event: {
16
+ response?: ServerResponse;
17
+ request?: IncomingMessage;
18
+ };
16
19
  ignoreUrlPatterns?: any[];
17
- response?: PlatformResponse;
18
- request?: PlatformRequest;
19
20
  endpoint?: EndpointMetadata;
20
21
  }
21
22
  export declare class PlatformContext extends DIContext implements ContextMethods {
@@ -36,11 +37,8 @@ export declare class PlatformContext extends DIContext implements ContextMethods
36
37
  * The current @@PlatformRequest@@.
37
38
  */
38
39
  request: PlatformRequest;
39
- /**
40
- *
41
- */
42
- readonly url: string;
43
- constructor({ response, request, endpoint, url, ignoreUrlPatterns, ...options }: PlatformContextOptions);
40
+ constructor({ event, endpoint, ignoreUrlPatterns, ResponseKlass, RequestKlass, ...options }: PlatformContextOptions);
41
+ get url(): string;
44
42
  get app(): PlatformApplication<TsED.Application, TsED.Router>;
45
43
  destroy(): Promise<void>;
46
44
  isDone(): boolean;
@@ -4,4 +4,3 @@ export * from "./PlatformRouteDetails";
4
4
  export * from "./ControllerProvider";
5
5
  export * from "./EndpointMetadata";
6
6
  export * from "./HandlerMetadata";
7
- export * from "./PropertyMetadata";