@tsed/platform-serverless 6.95.6 → 6.95.10
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/package.json +9 -9
- package/lib/cjs/builder/PlatformServerless.d.ts +0 -31
- package/lib/cjs/builder/PlatformServerlessHandler.d.ts +0 -19
- package/lib/cjs/domain/ServerlessContext.d.ts +0 -19
- package/lib/cjs/domain/ServerlessRequest.d.ts +0 -55
- package/lib/cjs/domain/ServerlessResponse.d.ts +0 -105
- package/lib/cjs/index.d.ts +0 -8
- package/lib/cjs/utils/getRequestId.d.ts +0 -2
- package/lib/cjs/utils/setResponseHeaders.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-serverless",
|
|
3
|
-
"version": "6.95.
|
|
3
|
+
"version": "6.95.10",
|
|
4
4
|
"description": "Platform serverless module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"test": "cross-env NODE_ENV=test jest"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tsed/core": "6.95.
|
|
23
|
-
"@tsed/di": "6.95.
|
|
24
|
-
"@tsed/exceptions": "6.95.
|
|
25
|
-
"@tsed/json-mapper": "6.95.
|
|
22
|
+
"@tsed/core": "6.95.10",
|
|
23
|
+
"@tsed/di": "6.95.10",
|
|
24
|
+
"@tsed/exceptions": "6.95.10",
|
|
25
|
+
"@tsed/json-mapper": "6.95.10",
|
|
26
26
|
"@tsed/logger": "^6.0.0",
|
|
27
|
-
"@tsed/platform-exceptions": "6.95.
|
|
28
|
-
"@tsed/platform-params": "6.95.
|
|
29
|
-
"@tsed/schema": "6.95.
|
|
27
|
+
"@tsed/platform-exceptions": "6.95.10",
|
|
28
|
+
"@tsed/platform-params": "6.95.10",
|
|
29
|
+
"@tsed/schema": "6.95.10",
|
|
30
30
|
"encodeurl": "^1.0.2",
|
|
31
31
|
"mime": "^2.5.2",
|
|
32
32
|
"tslib": "2.2.0",
|
|
33
33
|
"uuid": "^8.3.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@tsed/platform-serverless-testing": "6.95.
|
|
36
|
+
"@tsed/platform-serverless-testing": "6.95.10",
|
|
37
37
|
"@types/aws-lambda": "^8.10.83",
|
|
38
38
|
"@types/encodeurl": "^1.0.0",
|
|
39
39
|
"@types/mime": "^2.0.3"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { InjectorService } from "@tsed/di";
|
|
3
|
-
import type { Instance } from "find-my-way";
|
|
4
|
-
import type { Handler } from "aws-lambda";
|
|
5
|
-
export interface PlatformServerlessSettings extends Partial<TsED.Configuration> {
|
|
6
|
-
lambda?: Type[];
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @platform
|
|
10
|
-
*/
|
|
11
|
-
export declare class PlatformServerless {
|
|
12
|
-
readonly name: string;
|
|
13
|
-
private _injector;
|
|
14
|
-
private _router;
|
|
15
|
-
private _promise;
|
|
16
|
-
get injector(): InjectorService;
|
|
17
|
-
get settings(): TsED.Configuration & import("@tsed/di").DIConfiguration;
|
|
18
|
-
get promise(): Promise<any>;
|
|
19
|
-
static bootstrap(settings?: Partial<TsED.Configuration> & {
|
|
20
|
-
lambda?: Type[];
|
|
21
|
-
}): PlatformServerless;
|
|
22
|
-
handler(): Handler;
|
|
23
|
-
callbacks(tokens?: Type | Type[], callbacks?: any): Record<string, Handler>;
|
|
24
|
-
ready(): Promise<void>;
|
|
25
|
-
stop(): Promise<void>;
|
|
26
|
-
init(): Promise<any>;
|
|
27
|
-
protected callback(token: Type<any>, propertyKey: string): Handler;
|
|
28
|
-
protected initRouter(): Promise<Instance<any>>;
|
|
29
|
-
protected createInjector(settings: any): this;
|
|
30
|
-
protected loadInjector(): Promise<void>;
|
|
31
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { InjectorService, TokenProvider } from "@tsed/di";
|
|
2
|
-
import { PlatformParams } from "@tsed/platform-params";
|
|
3
|
-
import type { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
4
|
-
import { ServerlessContext } from "../domain/ServerlessContext";
|
|
5
|
-
export declare class PlatformServerlessHandler {
|
|
6
|
-
protected injector: InjectorService;
|
|
7
|
-
protected params: PlatformParams;
|
|
8
|
-
protected exceptionsManager: Promise<PlatformExceptions>;
|
|
9
|
-
createHandler(token: TokenProvider, propertyKey: string | symbol): ($ctx: ServerlessContext) => Promise<{
|
|
10
|
-
statusCode: number;
|
|
11
|
-
body: any;
|
|
12
|
-
headers: {
|
|
13
|
-
"x-request-id": string;
|
|
14
|
-
};
|
|
15
|
-
isBase64Encoded: boolean;
|
|
16
|
-
}>;
|
|
17
|
-
private flush;
|
|
18
|
-
private processResult;
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DIContext, DIContextOptions } from "@tsed/di";
|
|
2
|
-
import { JsonEntityStore } from "@tsed/schema";
|
|
3
|
-
import { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEventBase, Context } from "aws-lambda";
|
|
4
|
-
import { ServerlessRequest } from "./ServerlessRequest";
|
|
5
|
-
import { ServerlessResponse } from "./ServerlessResponse";
|
|
6
|
-
export interface ServerlessContextOptions extends DIContextOptions {
|
|
7
|
-
event: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
8
|
-
context: Context;
|
|
9
|
-
endpoint: JsonEntityStore;
|
|
10
|
-
}
|
|
11
|
-
export declare class ServerlessContext extends DIContext {
|
|
12
|
-
readonly response: ServerlessResponse;
|
|
13
|
-
readonly request: ServerlessRequest;
|
|
14
|
-
readonly context: Context;
|
|
15
|
-
readonly event: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
16
|
-
readonly endpoint: JsonEntityStore;
|
|
17
|
-
constructor({ event, context, endpoint, ...options }: ServerlessContextOptions);
|
|
18
|
-
destroy(): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEventBase, Context } from "aws-lambda";
|
|
2
|
-
export interface ServerlessRequestOptions {
|
|
3
|
-
event: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
4
|
-
context: Context;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* @platform
|
|
8
|
-
*/
|
|
9
|
-
export declare class ServerlessRequest {
|
|
10
|
-
readonly raw: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
11
|
-
constructor({ event }: ServerlessRequestOptions);
|
|
12
|
-
get secure(): boolean;
|
|
13
|
-
get host(): string;
|
|
14
|
-
get protocol(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Get the url of the request.
|
|
17
|
-
*
|
|
18
|
-
* Is equivalent of `express.response.originalUrl || express.response.url`.
|
|
19
|
-
*/
|
|
20
|
-
get url(): string;
|
|
21
|
-
get headers(): import("aws-lambda").APIGatewayProxyEventHeaders;
|
|
22
|
-
get method(): string;
|
|
23
|
-
/**
|
|
24
|
-
* Contains key-value pairs of data submitted in the request body. By default, it is `undefined`, and is populated when you use
|
|
25
|
-
* `body-parsing` middleware such as `express.json()` or `express.urlencoded()`.
|
|
26
|
-
*/
|
|
27
|
-
get body(): any;
|
|
28
|
-
get rawBody(): any;
|
|
29
|
-
/**
|
|
30
|
-
* This property is an object containing properties mapped to the named route `parameters`.
|
|
31
|
-
* For example, if you have the route `/user/:name`, then the `name` property is available as `req.params.name`.
|
|
32
|
-
* This object defaults to `{}`.
|
|
33
|
-
*/
|
|
34
|
-
get params(): {
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* This property is an object containing a property for each query string parameter in the route.
|
|
39
|
-
* When query parser is set to disabled, it is an empty object `{}`, otherwise it is the result of the configured query parser.
|
|
40
|
-
*/
|
|
41
|
-
get query(): {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Returns the HTTP request header specified by field. The match is case-insensitive.
|
|
46
|
-
*
|
|
47
|
-
* ```typescript
|
|
48
|
-
* request.get('Content-Type') // => "text/plain"
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @param name
|
|
52
|
-
*/
|
|
53
|
-
get(name: string): any;
|
|
54
|
-
destroy(): void;
|
|
55
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEventBase, Context } from "aws-lambda";
|
|
2
|
-
import type { ServerlessRequest } from "./ServerlessRequest";
|
|
3
|
-
export interface ServerlessResponseOptions {
|
|
4
|
-
event: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
5
|
-
context: Context;
|
|
6
|
-
request: ServerlessRequest;
|
|
7
|
-
}
|
|
8
|
-
export declare type HeaderValue = boolean | number | string;
|
|
9
|
-
/**
|
|
10
|
-
* @platform
|
|
11
|
-
*/
|
|
12
|
-
export declare class ServerlessResponse {
|
|
13
|
-
#private;
|
|
14
|
-
readonly event: APIGatewayProxyEventBase<APIGatewayEventDefaultAuthorizerContext>;
|
|
15
|
-
readonly request: ServerlessRequest;
|
|
16
|
-
constructor({ event, request }: ServerlessResponseOptions);
|
|
17
|
-
/**
|
|
18
|
-
* Get the current statusCode
|
|
19
|
-
*/
|
|
20
|
-
get statusCode(): number;
|
|
21
|
-
set statusCode(status: number);
|
|
22
|
-
/**
|
|
23
|
-
* An object that contains response local variables scoped to the request, and therefore available only to the view(s) rendered during that request / response cycle (if any). Otherwise, this property is identical to app.locals.
|
|
24
|
-
*
|
|
25
|
-
* This property is useful for exposing request-level information such as the request path name, authenticated user, user settings, and so on.
|
|
26
|
-
*/
|
|
27
|
-
get locals(): Record<string, any>;
|
|
28
|
-
get isHeadersSent(): boolean;
|
|
29
|
-
getStatus(): number;
|
|
30
|
-
/**
|
|
31
|
-
* Sets the HTTP status for the response.
|
|
32
|
-
*
|
|
33
|
-
* @param status
|
|
34
|
-
*/
|
|
35
|
-
status(status: number): this;
|
|
36
|
-
set(name: string, value: any): this;
|
|
37
|
-
/**
|
|
38
|
-
* Returns the HTTP response header specified by field. The match is case-insensitive.
|
|
39
|
-
*
|
|
40
|
-
* ```typescript
|
|
41
|
-
* response.get('Content-Type') // => "text/plain"
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @param name
|
|
45
|
-
*/
|
|
46
|
-
get(name: string): string | number | boolean | undefined;
|
|
47
|
-
getHeaders(): Record<string, HeaderValue>;
|
|
48
|
-
hasStatus(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Set header `field` to `val`, or pass
|
|
51
|
-
* an object of header fields.
|
|
52
|
-
*
|
|
53
|
-
* Examples:
|
|
54
|
-
* ```typescript
|
|
55
|
-
* response.setHeaders({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* Aliased as `res.header()`.
|
|
59
|
-
*/
|
|
60
|
-
setHeaders(headers: Record<string, HeaderValue>): this;
|
|
61
|
-
setHeader(key: string, item: HeaderValue | null | undefined): this;
|
|
62
|
-
/**
|
|
63
|
-
* Set `Content-Type` response header with `type` through `mime.lookup()`
|
|
64
|
-
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
65
|
-
*
|
|
66
|
-
* Examples:
|
|
67
|
-
*
|
|
68
|
-
* res.type('.html');
|
|
69
|
-
* res.type('html');
|
|
70
|
-
* res.type('json');
|
|
71
|
-
* res.type('application/json');
|
|
72
|
-
* res.type('png');
|
|
73
|
-
*/
|
|
74
|
-
contentType(contentType: string): this;
|
|
75
|
-
contentLength(length: number): this;
|
|
76
|
-
getContentLength(): number | undefined;
|
|
77
|
-
getContentType(): string;
|
|
78
|
-
/**
|
|
79
|
-
* Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an [HTTP status code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).
|
|
80
|
-
* If not specified, status defaults to `302 Found`.
|
|
81
|
-
*
|
|
82
|
-
* @param status
|
|
83
|
-
* @param url
|
|
84
|
-
*/
|
|
85
|
-
redirect(status: number, url: string): this;
|
|
86
|
-
/**
|
|
87
|
-
* Sets the response Location HTTP header to the specified path parameter.
|
|
88
|
-
*
|
|
89
|
-
* @param url
|
|
90
|
-
*/
|
|
91
|
-
location(url: string): this;
|
|
92
|
-
/**
|
|
93
|
-
* Send any data to your consumer.
|
|
94
|
-
*
|
|
95
|
-
* This method accept a ReadableStream, a plain object, boolean, string, number, null and undefined data.
|
|
96
|
-
* It choose the better way to send the data.
|
|
97
|
-
*
|
|
98
|
-
* @param body
|
|
99
|
-
*/
|
|
100
|
-
body(body: any): this;
|
|
101
|
-
getBody(): any;
|
|
102
|
-
isDone(): boolean;
|
|
103
|
-
onEnd(cb: Function): this;
|
|
104
|
-
destroy(): void;
|
|
105
|
-
}
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "@tsed/di";
|
|
2
|
-
export { Get, Post, Put, Delete, Head, Patch, Options, Route as Lambda } from "@tsed/schema";
|
|
3
|
-
export * from "@tsed/platform-params";
|
|
4
|
-
export * from "./builder/PlatformServerlessHandler";
|
|
5
|
-
export * from "./builder/PlatformServerless";
|
|
6
|
-
export * from "./domain/ServerlessContext";
|
|
7
|
-
export * from "./domain/ServerlessResponse";
|
|
8
|
-
export * from "./domain/ServerlessResponse";
|