@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.
- package/lib/builder/PlatformBuilder.d.ts +0 -4
- package/lib/decorators/index.d.ts +0 -2
- package/lib/decorators/method/location.d.ts +1 -20
- package/lib/decorators/method/redirect.d.ts +1 -50
- package/lib/domain/EndpointMetadata.d.ts +0 -4
- package/lib/domain/PlatformContext.d.ts +6 -8
- package/lib/domain/index.d.ts +0 -1
- package/lib/index.js +177 -248
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +169 -246
- package/lib/index.modern.js.map +1 -1
- package/lib/interfaces/IncomingEvent.d.ts +6 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/middlewares/index.d.ts +0 -2
- package/lib/services/PlatformRequest.d.ts +7 -1
- package/lib/services/PlatformResponse.d.ts +12 -9
- package/lib/services/PlatformTest.d.ts +3 -1
- package/lib/utils/createContext.d.ts +2 -5
- package/lib/utils/index.d.ts +0 -1
- package/package.json +15 -15
- package/lib/decorators/params/endpointInfo.d.ts +0 -10
- package/lib/decorators/params/responseData.d.ts +0 -9
- package/lib/domain/PropertyMetadata.d.ts +0 -11
- package/lib/middlewares/AcceptMimesMiddleware.d.ts +0 -10
- package/lib/middlewares/GlobalAcceptMimesMiddleware.d.ts +0 -9
- package/lib/utils/loadInjector.d.ts +0 -6
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from "./bindEndpointMiddleware";
|
|
2
2
|
export * from "./PlatformLogMiddleware";
|
|
3
3
|
export * from "./PlatformMulterMiddleware";
|
|
4
|
-
export * from "./GlobalAcceptMimesMiddleware";
|
|
5
4
|
export * from "./PlatformAcceptMimesMiddleware";
|
|
6
|
-
export * from "./AcceptMimesMiddleware";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IncomingHttpHeaders, IncomingMessage } from "http";
|
|
3
3
|
import type { PlatformContext } from "../domain/PlatformContext";
|
|
4
|
+
import { IncomingEvent } from "../interfaces/IncomingEvent";
|
|
5
|
+
import type { PlatformResponse } from "./PlatformResponse";
|
|
4
6
|
declare global {
|
|
5
7
|
namespace TsED {
|
|
6
8
|
interface Request {
|
|
@@ -17,7 +19,11 @@ export declare class PlatformRequest<T extends {
|
|
|
17
19
|
[key: string]: any;
|
|
18
20
|
} = any> {
|
|
19
21
|
raw: T;
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The current @@PlatformResponse@@.
|
|
24
|
+
*/
|
|
25
|
+
response: PlatformResponse;
|
|
26
|
+
constructor({ request }: IncomingEvent);
|
|
21
27
|
get secure(): boolean;
|
|
22
28
|
get host(): string;
|
|
23
29
|
get protocol(): string;
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { PlatformViews } from "@tsed/platform-views";
|
|
3
3
|
import { ServerResponse } from "http";
|
|
4
|
+
import { IncomingEvent } from "../interfaces/IncomingEvent";
|
|
5
|
+
import type { PlatformRequest } from "./PlatformRequest";
|
|
4
6
|
declare global {
|
|
5
7
|
namespace TsED {
|
|
6
8
|
interface Response {
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
}
|
|
12
|
+
export declare type HeaderValue = Array<boolean | number | string> | boolean | number | string;
|
|
10
13
|
/**
|
|
11
14
|
* Platform Response abstraction layer.
|
|
12
15
|
* @platform
|
|
13
16
|
*/
|
|
14
|
-
export declare class PlatformResponse<T extends {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
} = any> {
|
|
17
|
-
raw: T;
|
|
17
|
+
export declare class PlatformResponse<T extends Record<string, any> = any> {
|
|
18
18
|
platformViews: PlatformViews;
|
|
19
|
+
/**
|
|
20
|
+
* The current @@PlatformRequest@@.
|
|
21
|
+
*/
|
|
22
|
+
request: PlatformRequest;
|
|
19
23
|
data: any;
|
|
20
|
-
|
|
24
|
+
raw: T;
|
|
25
|
+
constructor({ response }: IncomingEvent);
|
|
21
26
|
/**
|
|
22
27
|
* Get the current statusCode
|
|
23
28
|
*/
|
|
@@ -47,7 +52,7 @@ export declare class PlatformResponse<T extends {
|
|
|
47
52
|
* @param name
|
|
48
53
|
*/
|
|
49
54
|
get(name: string): any;
|
|
50
|
-
getHeaders(): Record<string,
|
|
55
|
+
getHeaders(): Record<string, HeaderValue>;
|
|
51
56
|
/**
|
|
52
57
|
* Return the Framework response object (express, koa, etc...)
|
|
53
58
|
*/
|
|
@@ -74,9 +79,7 @@ export declare class PlatformResponse<T extends {
|
|
|
74
79
|
*
|
|
75
80
|
* Aliased as `res.header()`.
|
|
76
81
|
*/
|
|
77
|
-
setHeaders(headers:
|
|
78
|
-
[key: string]: any;
|
|
79
|
-
}): this;
|
|
82
|
+
setHeaders(headers: Record<string, HeaderValue>): this;
|
|
80
83
|
setHeader(key: string, item: any): this;
|
|
81
84
|
/**
|
|
82
85
|
* Set `Content-Type` response header with `type` through `mime.lookup()`
|
|
@@ -51,5 +51,7 @@ export declare class PlatformTest extends DITest {
|
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
53
|
static callback(): any;
|
|
54
|
-
static
|
|
54
|
+
static createRequest(options?: any): any;
|
|
55
|
+
static createResponse(options?: any): any;
|
|
56
|
+
static createRequestContext(options?: Partial<PlatformContextOptions & any>): PlatformContext;
|
|
55
57
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { InjectorService } from "@tsed/di";
|
|
2
2
|
import { PlatformContext } from "../domain/PlatformContext";
|
|
3
|
-
import {
|
|
4
|
-
import { PlatformResponse } from "../services/PlatformResponse";
|
|
3
|
+
import { IncomingEvent } from "../interfaces/IncomingEvent";
|
|
5
4
|
/**
|
|
6
5
|
* Create the TsED context to wrap request, response, injector, etc...
|
|
7
6
|
* @param injector
|
|
8
|
-
* @param request
|
|
9
|
-
* @param response
|
|
10
7
|
* @ignore
|
|
11
8
|
*/
|
|
12
|
-
export declare function createContext(injector: InjectorService
|
|
9
|
+
export declare function createContext(injector: InjectorService): (event: IncomingEvent) => Promise<PlatformContext>;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from "./createInjector";
|
|
|
2
2
|
export * from "./createPlatformApplication";
|
|
3
3
|
export * from "./createHttpServer";
|
|
4
4
|
export * from "./createHttpsServer";
|
|
5
|
-
export * from "./loadInjector";
|
|
6
5
|
export * from "./printRoutes";
|
|
7
6
|
export * from "./listenServer";
|
|
8
7
|
export * from "./createContext";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "A TypeScript Framework on top of Express",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"bugs": {
|
|
40
40
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
41
41
|
},
|
|
42
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
42
|
+
"homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/platform/common",
|
|
43
43
|
"repository": "https://github.com/tsedio/tsed",
|
|
44
44
|
"funding": [
|
|
45
45
|
{
|
|
@@ -55,20 +55,20 @@
|
|
|
55
55
|
"build": "microbundle --target node --no-compress --format modern,cjs --tsconfig ./tsconfig.compile.json"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@tsed/components-scan": "
|
|
59
|
-
"@tsed/core": "
|
|
60
|
-
"@tsed/di": "
|
|
61
|
-
"@tsed/exceptions": "
|
|
62
|
-
"@tsed/json-mapper": "
|
|
58
|
+
"@tsed/components-scan": "7.0.0-alpha.1",
|
|
59
|
+
"@tsed/core": "7.0.0-alpha.1",
|
|
60
|
+
"@tsed/di": "7.0.0-alpha.1",
|
|
61
|
+
"@tsed/exceptions": "7.0.0-alpha.1",
|
|
62
|
+
"@tsed/json-mapper": "7.0.0-alpha.1",
|
|
63
63
|
"@tsed/logger": "^5.16.0",
|
|
64
|
-
"@tsed/perf": "
|
|
65
|
-
"@tsed/platform-cache": "
|
|
66
|
-
"@tsed/platform-exceptions": "
|
|
67
|
-
"@tsed/platform-middlewares": "
|
|
68
|
-
"@tsed/platform-params": "
|
|
69
|
-
"@tsed/platform-response-filter": "
|
|
70
|
-
"@tsed/platform-views": "
|
|
71
|
-
"@tsed/schema": "
|
|
64
|
+
"@tsed/perf": "7.0.0-alpha.1",
|
|
65
|
+
"@tsed/platform-cache": "7.0.0-alpha.1",
|
|
66
|
+
"@tsed/platform-exceptions": "7.0.0-alpha.1",
|
|
67
|
+
"@tsed/platform-middlewares": "7.0.0-alpha.1",
|
|
68
|
+
"@tsed/platform-params": "7.0.0-alpha.1",
|
|
69
|
+
"@tsed/platform-response-filter": "7.0.0-alpha.1",
|
|
70
|
+
"@tsed/platform-views": "7.0.0-alpha.1",
|
|
71
|
+
"@tsed/schema": "7.0.0-alpha.1",
|
|
72
72
|
"@types/json-schema": "7.0.7",
|
|
73
73
|
"json-schema": "^0.2.3",
|
|
74
74
|
"on-finished": "2.3.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EndpointMetadata } from "../../domain/EndpointMetadata";
|
|
2
|
-
export declare type EndpointInfo = EndpointMetadata;
|
|
3
|
-
/**
|
|
4
|
-
* Get the current endpoint metadata.
|
|
5
|
-
* @decorator
|
|
6
|
-
* @operation
|
|
7
|
-
* @input
|
|
8
|
-
* @deprecated Use `@Context() $ctx: Context` then `$ctx.endpoint` instead.
|
|
9
|
-
*/
|
|
10
|
-
export declare function EndpointInfo(): Function;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return the current response data. Prefer the @@Context@@ decorator to get or set data.
|
|
3
|
-
*
|
|
4
|
-
* @decorator
|
|
5
|
-
* @operation
|
|
6
|
-
* @input
|
|
7
|
-
* @deprecated Use `@Context() $ctx: Context` then $ctx.data.
|
|
8
|
-
*/
|
|
9
|
-
export declare function ResponseData(): ParameterDecorator;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { JsonEntityStore } from "@tsed/schema";
|
|
3
|
-
export declare class PropertyMetadata extends JsonEntityStore {
|
|
4
|
-
static get(target: Type<any>, propertyKey: string | symbol): PropertyMetadata;
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
|
|
7
|
-
*/
|
|
8
|
-
static getProperties(target: Type<any>, options?: Partial<{
|
|
9
|
-
withIgnoredProps: boolean;
|
|
10
|
-
}>): Map<string | number | symbol, JsonEntityStore>;
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Context } from "@tsed/platform-params";
|
|
2
|
-
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
3
|
-
/**
|
|
4
|
-
* @middleware
|
|
5
|
-
* @deprecated Since 2020-11-30. Use PlatformAcceptMimesMiddleware.
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
export declare class AcceptMimesMiddleware implements MiddlewareMethods {
|
|
9
|
-
use(ctx: Context): void;
|
|
10
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
2
|
-
import { Context } from "@tsed/platform-params";
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Since 2020-11-30. Use PlatformAcceptMimesMiddleware.
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
export declare class GlobalAcceptMimesMiddleware implements MiddlewareMethods {
|
|
8
|
-
use(ctx: Context): void;
|
|
9
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Container, InjectorService, LocalsContainer } from "@tsed/di";
|
|
2
|
-
/**
|
|
3
|
-
* @ignore
|
|
4
|
-
* @deprecated User injector.load(container, module) instead
|
|
5
|
-
*/
|
|
6
|
-
export declare function loadInjector(injector: InjectorService, container?: Container): Promise<LocalsContainer<any>>;
|