@tsed/platform-serverless 7.79.4 → 7.80.0
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/cjs/builder/PlatformServerless.js +1 -24
- package/lib/cjs/builder/PlatformServerless.js.map +1 -1
- package/lib/cjs/builder/PlatformServerlessHandler.js +1 -1
- package/lib/cjs/builder/PlatformServerlessHandler.js.map +1 -1
- package/lib/esm/builder/PlatformServerless.js +1 -1
- package/lib/esm/builder/PlatformServerlessHandler.js +1 -1
- package/lib/esm/domain/ServerlessResponseStream.js +1 -1
- package/lib/types-esm/builder/PlatformServerless.d.ts +37 -0
- package/lib/types-esm/builder/PlatformServerlessHandler.d.ts +14 -0
- package/lib/types-esm/domain/ServerlessContext.d.ts +26 -0
- package/lib/types-esm/domain/ServerlessEvent.d.ts +2 -0
- package/lib/types-esm/domain/ServerlessRequest.d.ts +59 -0
- package/lib/types-esm/domain/ServerlessResponse.d.ts +101 -0
- package/lib/types-esm/domain/ServerlessResponseStream.d.ts +27 -0
- package/lib/types-esm/exports.d.ts +3 -0
- package/lib/types-esm/index.d.ts +14 -0
- package/lib/types-esm/utils/getRequestId.d.ts +3 -0
- package/lib/types-esm/utils/isInAWS.d.ts +1 -0
- package/lib/types-esm/utils/setResponseHeaders.d.ts +6 -0
- package/package.json +22 -18
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -20
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -54
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.PlatformServerless = void 0;
|
|
27
4
|
const core_1 = require("@tsed/core");
|
|
@@ -150,7 +127,7 @@ class PlatformServerless {
|
|
|
150
127
|
}
|
|
151
128
|
async initRouter() {
|
|
152
129
|
if (!this._router) {
|
|
153
|
-
const { default: FindMyMay } = await
|
|
130
|
+
const { default: FindMyMay } = await import("find-my-way");
|
|
154
131
|
this._router = FindMyMay({
|
|
155
132
|
caseSensitive: false,
|
|
156
133
|
ignoreTrailingSlash: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformServerless.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerless.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlatformServerless.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerless.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,iCAAkF;AAClF,yCAA0C;AAC1C,yCAAkE;AAIlE,yEAAiE;AAEjE,iFAAiG;AACjG,8DAAsD;AACtD,iFAAyE;AAMzE;;G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AS,GAAG,IAAA,oBAAe,GAAE,CAAC;QAEpC,IAAA,2BAAsB,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAExC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;CACF;AA5LD,gDA4LC"}
|
|
@@ -103,7 +103,7 @@ tslib_1.__decorate([
|
|
|
103
103
|
tslib_1.__metadata("design:type", platform_params_1.PlatformParams)
|
|
104
104
|
], PlatformServerlessHandler.prototype, "params", void 0);
|
|
105
105
|
tslib_1.__decorate([
|
|
106
|
-
(0, di_1.LazyInject)("PlatformExceptions", () =>
|
|
106
|
+
(0, di_1.LazyInject)("PlatformExceptions", () => import("@tsed/platform-exceptions")),
|
|
107
107
|
tslib_1.__metadata("design:type", Promise)
|
|
108
108
|
], PlatformServerlessHandler.prototype, "exceptionsManager", void 0);
|
|
109
109
|
PlatformServerlessHandler = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformServerlessHandler.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHandler.ts"],"names":[],"mappings":";;;;AAAA,qCAAoF;AACpF,iCAAoH;AACpH,mDAA4C;AAE5C,2DAAuF;AACvF,mDAA8C;AAG9C,iFAA4E;AAC5E,0EAAkE;AAM3D,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAE1B,QAAQ,CAAkB;IAG1B,MAAM,CAAiB;IAGvB,iBAAiB,CAA8B;IAEzD,aAAa,CAAC,KAAoB,EAAE,WAA4B;QAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAC,KAAK,EAAE,WAAW,EAAC,CAAC,CAAC;QAEzE,OAAO,CAAC,IAAwC,E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AC;;oEACnB;AAR9C,yBAAyB;IAJrC,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,OAAO,EAAE,CAAC,kCAAgB,EAAE,gCAAc,CAAC;KAC5C,CAAC;GACW,yBAAyB,CAgHrC;AAhHY,8DAAyB"}
|
|
@@ -3,7 +3,7 @@ import { createContainer, InjectorService, setLoggerConfiguration } from "@tsed/
|
|
|
3
3
|
import { $log } from "@tsed/logger";
|
|
4
4
|
import { getOperationsRoutes, JsonEntityStore } from "@tsed/schema";
|
|
5
5
|
import { ServerlessContext } from "../domain/ServerlessContext.js";
|
|
6
|
-
import { ServerlessResponseStream } from "../domain/ServerlessResponseStream
|
|
6
|
+
import { ServerlessResponseStream } from "../domain/ServerlessResponseStream";
|
|
7
7
|
import { getRequestId } from "../utils/getRequestId.js";
|
|
8
8
|
import { PlatformServerlessHandler } from "./PlatformServerlessHandler.js";
|
|
9
9
|
/**
|
|
@@ -4,7 +4,7 @@ import { Inject, Injectable, InjectorService, LazyInject, ProviderScope } from "
|
|
|
4
4
|
import { serialize } from "@tsed/json-mapper";
|
|
5
5
|
import { DeserializerPipe, PlatformParams, ValidationPipe } from "@tsed/platform-params";
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
|
-
import { ServerlessResponseStream } from "../domain/ServerlessResponseStream
|
|
7
|
+
import { ServerlessResponseStream } from "../domain/ServerlessResponseStream";
|
|
8
8
|
import { setResponseHeaders } from "../utils/setResponseHeaders.js";
|
|
9
9
|
let PlatformServerlessHandler = class PlatformServerlessHandler {
|
|
10
10
|
injector;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Type } from "@tsed/core";
|
|
2
|
+
import { InjectorService } from "@tsed/di";
|
|
3
|
+
import type { Handler } from "aws-lambda";
|
|
4
|
+
import type { Instance } from "find-my-way";
|
|
5
|
+
import type { ServerlessEvent } from "../domain/ServerlessEvent";
|
|
6
|
+
import { type RequestHandler } from "../domain/ServerlessResponseStream";
|
|
7
|
+
export interface PlatformServerlessSettings extends Partial<TsED.Configuration> {
|
|
8
|
+
lambda?: Type[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @platform
|
|
12
|
+
*/
|
|
13
|
+
export declare class PlatformServerless {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
private _injector;
|
|
16
|
+
private _router;
|
|
17
|
+
private _promise;
|
|
18
|
+
get injector(): InjectorService;
|
|
19
|
+
get settings(): import("@tsed/di").DIConfiguration;
|
|
20
|
+
get promise(): Promise<any>;
|
|
21
|
+
static bootstrap(settings?: Partial<TsED.Configuration> & {
|
|
22
|
+
lambda?: Type[];
|
|
23
|
+
}): PlatformServerless;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new handler from the given token and propertyKey. No routing is used here.
|
|
26
|
+
*/
|
|
27
|
+
static callback(token: Type<any>, propertyKey: string, settings?: Partial<TsED.Configuration>): Handler<ServerlessEvent> | RequestHandler;
|
|
28
|
+
handler(): Handler;
|
|
29
|
+
callbacks(tokens?: Type | Type[], callbacks?: any): Record<string, Handler>;
|
|
30
|
+
ready(): Promise<void>;
|
|
31
|
+
stop(): Promise<void>;
|
|
32
|
+
init(): Promise<any>;
|
|
33
|
+
protected callback(token: Type<any>, propertyKey: string): Handler<ServerlessEvent> | RequestHandler;
|
|
34
|
+
protected initRouter(): Promise<Instance<any>>;
|
|
35
|
+
protected createInjector(settings: any): this;
|
|
36
|
+
protected loadInjector(): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InjectorService, TokenProvider } from "@tsed/di";
|
|
2
|
+
import type { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
3
|
+
import { PlatformParams } from "@tsed/platform-params";
|
|
4
|
+
import { ServerlessContext } from "../domain/ServerlessContext.js";
|
|
5
|
+
import type { ServerlessEvent } from "../domain/ServerlessEvent";
|
|
6
|
+
export declare class PlatformServerlessHandler {
|
|
7
|
+
protected injector: InjectorService;
|
|
8
|
+
protected params: PlatformParams;
|
|
9
|
+
protected exceptionsManager: Promise<PlatformExceptions>;
|
|
10
|
+
createHandler(token: TokenProvider, propertyKey: string | symbol): ($ctx: ServerlessContext<ServerlessEvent>) => Promise<any>;
|
|
11
|
+
private flush;
|
|
12
|
+
private makeHttpResponse;
|
|
13
|
+
private processResult;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DIContext, DIContextOptions } from "@tsed/di";
|
|
2
|
+
import { JsonEntityStore } from "@tsed/schema";
|
|
3
|
+
import { type APIGatewayProxyEvent, Context } from "aws-lambda";
|
|
4
|
+
import { ServerlessRequest } from "./ServerlessRequest.js";
|
|
5
|
+
import { ServerlessResponse } from "./ServerlessResponse.js";
|
|
6
|
+
import type { ServerlessResponseStream } from "./ServerlessResponseStream";
|
|
7
|
+
export interface ServerlessContextOptions<Event = APIGatewayProxyEvent> extends DIContextOptions {
|
|
8
|
+
event: Event;
|
|
9
|
+
context: Context;
|
|
10
|
+
responseStream?: ServerlessResponseStream;
|
|
11
|
+
endpoint: JsonEntityStore;
|
|
12
|
+
}
|
|
13
|
+
export declare class ServerlessContext<Event extends object = APIGatewayProxyEvent> extends DIContext {
|
|
14
|
+
readonly response: ServerlessResponse<Event>;
|
|
15
|
+
readonly request: ServerlessRequest<Event>;
|
|
16
|
+
readonly context: Context;
|
|
17
|
+
readonly event: Event;
|
|
18
|
+
readonly responseStream: ServerlessResponseStream | undefined;
|
|
19
|
+
readonly endpoint: JsonEntityStore;
|
|
20
|
+
readonly PLATFORM = "SERVERLESS";
|
|
21
|
+
constructor({ event, context, endpoint, responseStream, ...options }: ServerlessContextOptions<Event>);
|
|
22
|
+
isHttpEvent(): boolean;
|
|
23
|
+
isAuthorizerEvent(): boolean;
|
|
24
|
+
destroy(): Promise<void>;
|
|
25
|
+
isDone(): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayTokenAuthorizerEvent, CloudWatchLogsEvent, DynamoDBStreamEvent, KinesisStreamEvent, S3Event, ScheduledEvent, SNSEvent, SQSEvent } from "aws-lambda";
|
|
2
|
+
export type ServerlessEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | S3Event | SQSEvent | SNSEvent | DynamoDBStreamEvent | KinesisStreamEvent | CloudWatchLogsEvent | ScheduledEvent | APIGatewayTokenAuthorizerEvent;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
2
|
+
import { ServerlessContext } from "./ServerlessContext.js";
|
|
3
|
+
/**
|
|
4
|
+
* @platform
|
|
5
|
+
*/
|
|
6
|
+
export declare class ServerlessRequest<Event extends object = APIGatewayProxyEvent> {
|
|
7
|
+
protected $ctx: ServerlessContext<Event>;
|
|
8
|
+
constructor($ctx: ServerlessContext<Event>);
|
|
9
|
+
/**
|
|
10
|
+
* APIGatewayProxyEvent to no break the current code
|
|
11
|
+
* @note use getEvent() instead to use generic type
|
|
12
|
+
*/
|
|
13
|
+
get event(): APIGatewayProxyEvent;
|
|
14
|
+
get raw(): Event;
|
|
15
|
+
get response(): import("./ServerlessResponse.js").ServerlessResponse<Event>;
|
|
16
|
+
get secure(): boolean;
|
|
17
|
+
get host(): string;
|
|
18
|
+
get protocol(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the url of the request.
|
|
21
|
+
*
|
|
22
|
+
* Is equivalent of `express.response.originalUrl || express.response.url`.
|
|
23
|
+
*/
|
|
24
|
+
get url(): string;
|
|
25
|
+
get headers(): import("aws-lambda").APIGatewayProxyEventHeaders;
|
|
26
|
+
get method(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Contains key-value pairs of data submitted in the request body. By default, it is `undefined`, and is populated when you use
|
|
29
|
+
* `body-parsing` middleware such as `express.json()` or `express.urlencoded()`.
|
|
30
|
+
*/
|
|
31
|
+
get body(): any;
|
|
32
|
+
get rawBody(): any;
|
|
33
|
+
/**
|
|
34
|
+
* This property is an object containing properties mapped to the named route `parameters`.
|
|
35
|
+
* For example, if you have the route `/user/:name`, then the `name` property is available as `req.params.name`.
|
|
36
|
+
* This object defaults to `{}`.
|
|
37
|
+
*/
|
|
38
|
+
get params(): {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* This property is an object containing a property for each query string parameter in the route.
|
|
43
|
+
* When query parser is set to disabled, it is an empty object `{}`, otherwise it is the result of the configured query parser.
|
|
44
|
+
*/
|
|
45
|
+
get query(): {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
getEvent<E = Event>(): E;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the HTTP request header specified by field. The match is case-insensitive.
|
|
51
|
+
*
|
|
52
|
+
* ```typescript
|
|
53
|
+
* request.get('Content-Type') // => "text/plain"
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param name
|
|
57
|
+
*/
|
|
58
|
+
get(name: string): any;
|
|
59
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { APIGatewayProxyEvent } from "aws-lambda";
|
|
2
|
+
import { ServerlessContext } from "./ServerlessContext.js";
|
|
3
|
+
export type HeaderValue = boolean | number | string;
|
|
4
|
+
/**
|
|
5
|
+
* @platform
|
|
6
|
+
*/
|
|
7
|
+
export declare class ServerlessResponse<Event extends object = APIGatewayProxyEvent> {
|
|
8
|
+
#private;
|
|
9
|
+
protected $ctx: ServerlessContext<Event>;
|
|
10
|
+
constructor($ctx: ServerlessContext<Event>);
|
|
11
|
+
get event(): Event;
|
|
12
|
+
get raw(): Event;
|
|
13
|
+
get request(): import("./ServerlessRequest.js").ServerlessRequest<Event>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the current statusCode
|
|
16
|
+
*/
|
|
17
|
+
get statusCode(): number;
|
|
18
|
+
set statusCode(status: number);
|
|
19
|
+
/**
|
|
20
|
+
* 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.
|
|
21
|
+
*
|
|
22
|
+
* This property is useful for exposing request-level information such as the request path name, authenticated user, user settings, and so on.
|
|
23
|
+
*/
|
|
24
|
+
get locals(): Record<string, any>;
|
|
25
|
+
get isHeadersSent(): boolean;
|
|
26
|
+
getStatus(): number;
|
|
27
|
+
/**
|
|
28
|
+
* Sets the HTTP status for the response.
|
|
29
|
+
*
|
|
30
|
+
* @param status
|
|
31
|
+
*/
|
|
32
|
+
status(status: number): this;
|
|
33
|
+
set(name: string, value: any): this;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the HTTP response header specified by field. The match is case-insensitive.
|
|
36
|
+
*
|
|
37
|
+
* ```typescript
|
|
38
|
+
* response.get('Content-Type') // => "text/plain"
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param name
|
|
42
|
+
*/
|
|
43
|
+
get(name: string): string | number | boolean | undefined;
|
|
44
|
+
getHeaders(): Record<string, HeaderValue>;
|
|
45
|
+
hasStatus(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Set header `field` to `val`, or pass
|
|
48
|
+
* an object of header fields.
|
|
49
|
+
*
|
|
50
|
+
* Examples:
|
|
51
|
+
* ```typescript
|
|
52
|
+
* response.setHeaders({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Aliased as `res.header()`.
|
|
56
|
+
*/
|
|
57
|
+
setHeaders(headers: Record<string, HeaderValue>): this;
|
|
58
|
+
setHeader(key: string, item: HeaderValue | null | undefined): this;
|
|
59
|
+
/**
|
|
60
|
+
* Set `Content-Type` response header with `type` through `mime.lookup()`
|
|
61
|
+
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
62
|
+
*
|
|
63
|
+
* Examples:
|
|
64
|
+
*
|
|
65
|
+
* res.type('.html');
|
|
66
|
+
* res.type('html');
|
|
67
|
+
* res.type('json');
|
|
68
|
+
* res.type('application/json');
|
|
69
|
+
* res.type('png');
|
|
70
|
+
*/
|
|
71
|
+
contentType(contentType: string): this;
|
|
72
|
+
contentLength(length: number): this;
|
|
73
|
+
getContentLength(): number | undefined;
|
|
74
|
+
getContentType(): string;
|
|
75
|
+
/**
|
|
76
|
+
* 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).
|
|
77
|
+
* If not specified, status defaults to `302 Found`.
|
|
78
|
+
*
|
|
79
|
+
* @param status
|
|
80
|
+
* @param url
|
|
81
|
+
*/
|
|
82
|
+
redirect(status: number, url: string): this;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the response Location HTTP header to the specified path parameter.
|
|
85
|
+
*
|
|
86
|
+
* @param url
|
|
87
|
+
*/
|
|
88
|
+
location(url: string): this;
|
|
89
|
+
/**
|
|
90
|
+
* Send any data to your consumer.
|
|
91
|
+
*
|
|
92
|
+
* This method accept a ReadableStream, a plain object, boolean, string, number, null and undefined data.
|
|
93
|
+
* It choose the better way to send the data.
|
|
94
|
+
*
|
|
95
|
+
* @param body
|
|
96
|
+
*/
|
|
97
|
+
body(body: any): this;
|
|
98
|
+
getBody(): any;
|
|
99
|
+
isDone(): boolean;
|
|
100
|
+
destroy(): void;
|
|
101
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { APIGatewayProxyEventV2, Callback, Context, Handler } from "aws-lambda";
|
|
3
|
+
import { Stream } from "node:stream";
|
|
4
|
+
export type ServerlessResponseMeta = {
|
|
5
|
+
statusCode: number;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
declare global {
|
|
9
|
+
const awsLambda: {
|
|
10
|
+
streamifyResponse(handler: Handler): unknown | Promise<unknown>;
|
|
11
|
+
HttpResponseStream: {
|
|
12
|
+
from(resStream: ServerlessResponseStream | unknown, meta: ServerlessResponseMeta): ServerlessResponseStream;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type RequestHandler = (ev: APIGatewayProxyEventV2, streamResponse?: ServerlessResponseStream, ctx?: Context, callback?: Callback) => unknown | Promise<unknown>;
|
|
17
|
+
export declare class ServerlessResponseStream extends Stream.Writable {
|
|
18
|
+
#private;
|
|
19
|
+
_meta: ServerlessResponseMeta;
|
|
20
|
+
constructor();
|
|
21
|
+
static setMeta(resStream: ServerlessResponseStream, meta: ServerlessResponseMeta): any;
|
|
22
|
+
static streamifyResponse(handler: RequestHandler): RequestHandler;
|
|
23
|
+
private static buildResponse;
|
|
24
|
+
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
25
|
+
setMeta(meta: ServerlessResponseMeta): void;
|
|
26
|
+
getBufferedData(): Buffer;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./builder/PlatformServerless.js";
|
|
5
|
+
export * from "./builder/PlatformServerlessHandler.js";
|
|
6
|
+
export * from "./domain/ServerlessContext.js";
|
|
7
|
+
export * from "./domain/ServerlessEvent.js";
|
|
8
|
+
export * from "./domain/ServerlessRequest.js";
|
|
9
|
+
export * from "./domain/ServerlessResponse.js";
|
|
10
|
+
export * from "./domain/ServerlessResponseStream.js";
|
|
11
|
+
export * from "./exports.js";
|
|
12
|
+
export * from "./utils/getRequestId.js";
|
|
13
|
+
export * from "./utils/isInAWS.js";
|
|
14
|
+
export * from "./utils/setResponseHeaders.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isInAWS(): boolean;
|
package/package.json
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-serverless",
|
|
3
|
-
"version": "7.79.4",
|
|
4
3
|
"description": "Platform serverless module for Ts.ED Framework",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.0",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/cjs/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn barrels && yarn build:ts",
|
|
17
19
|
"barrels": "barrels",
|
|
18
|
-
"test": "
|
|
19
|
-
"build:ts": "tsc --build tsconfig.json
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
22
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"@tsed/core": "7.
|
|
23
|
-
"@tsed/exceptions": "7.
|
|
24
|
-
"@tsed/json-mapper": "7.
|
|
25
|
-
"@tsed/platform-exceptions": "7.
|
|
26
|
-
"@tsed/platform-params": "7.
|
|
27
|
-
"@tsed/schema": "7.
|
|
25
|
+
"@tsed/core": "7.80.0",
|
|
26
|
+
"@tsed/exceptions": "7.80.0",
|
|
27
|
+
"@tsed/json-mapper": "7.80.0",
|
|
28
|
+
"@tsed/platform-exceptions": "7.80.0",
|
|
29
|
+
"@tsed/platform-params": "7.80.0",
|
|
30
|
+
"@tsed/schema": "7.80.0",
|
|
28
31
|
"encodeurl": "^2.0.0",
|
|
29
32
|
"mime": "^3.0.0",
|
|
30
33
|
"tslib": "2.6.1",
|
|
31
34
|
"uuid": "^9.0.1"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
|
-
"@tsed/barrels": "7.
|
|
35
|
-
"@tsed/platform-serverless-testing": "7.
|
|
36
|
-
"@tsed/typescript": "7.
|
|
37
|
+
"@tsed/barrels": "7.80.0",
|
|
38
|
+
"@tsed/platform-serverless-testing": "7.80.0",
|
|
39
|
+
"@tsed/typescript": "7.80.0",
|
|
37
40
|
"@types/aws-lambda": "^8.10.136",
|
|
38
41
|
"@types/encodeurl": "^1.0.2",
|
|
39
42
|
"@types/mime": "^3.0.4",
|
|
40
43
|
"eslint": "^8.57.0",
|
|
41
44
|
"find-my-way": "^8.2.0",
|
|
42
|
-
"
|
|
45
|
+
"typescript": "4.9.5",
|
|
46
|
+
"vitest": "2.0.4"
|
|
43
47
|
},
|
|
44
48
|
"peerDependencies": {
|
|
45
|
-
"@tsed/di": "7.
|
|
49
|
+
"@tsed/di": "7.80.0",
|
|
46
50
|
"@tsed/logger": ">=6.7.5",
|
|
47
51
|
"find-my-way": ">=7.0.0"
|
|
48
52
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/jest.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
const config = require("@tsed/jest-config");
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
...config,
|
|
7
|
-
roots: ["<rootDir>/src", "<rootDir>/test"],
|
|
8
|
-
moduleNameMapper: {
|
|
9
|
-
...config.moduleNameMapper,
|
|
10
|
-
"^@tsed/platform-serverless$": "<rootDir>/src/index.ts"
|
|
11
|
-
},
|
|
12
|
-
coverageThreshold: {
|
|
13
|
-
global: {
|
|
14
|
-
statements: 98.61,
|
|
15
|
-
branches: 90.24,
|
|
16
|
-
functions: 100,
|
|
17
|
-
lines: 98.61
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
package/tsconfig.esm.json
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"module": "ES2020",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./lib/types",
|
|
10
|
-
"composite": true,
|
|
11
|
-
"noEmit": false
|
|
12
|
-
},
|
|
13
|
-
"include": ["src", "src/**/*.json"],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"node_modules",
|
|
16
|
-
"test",
|
|
17
|
-
"lib",
|
|
18
|
-
"benchmark",
|
|
19
|
-
"coverage",
|
|
20
|
-
"spec",
|
|
21
|
-
"**/*.benchmark.ts",
|
|
22
|
-
"**/*.spec.ts",
|
|
23
|
-
"keys",
|
|
24
|
-
"jest.config.js",
|
|
25
|
-
"**/__mock__/**",
|
|
26
|
-
"webpack.config.js"
|
|
27
|
-
],
|
|
28
|
-
"references": [
|
|
29
|
-
{
|
|
30
|
-
"path": "../../di"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../platform-serverless-testing"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../core"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../specs/exceptions"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../specs/json-mapper"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../platform-exceptions"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../platform-params"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "../../specs/schema"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|