@tsed/platform-serverless 8.0.0-rc.5 → 8.0.0-rc.6
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/esm/builder/PlatformServerless.js +13 -17
- package/lib/esm/builder/PlatformServerless.js.map +1 -1
- package/lib/esm/builder/PlatformServerlessHandler.js +11 -26
- package/lib/esm/builder/PlatformServerlessHandler.js.map +1 -1
- package/lib/types/builder/PlatformServerless.d.ts +1 -2
- package/lib/types/builder/PlatformServerlessHandler.d.ts +1 -4
- package/package.json +13 -11
- package/vitest.config.mts +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Env } from "@tsed/core";
|
|
2
|
-
import { createContainer, injector, setLoggerConfiguration } from "@tsed/di";
|
|
2
|
+
import { configuration, constant, createContainer, destroyInjector, injector, setLoggerConfiguration } from "@tsed/di";
|
|
3
|
+
import { $asyncEmit } from "@tsed/hooks";
|
|
3
4
|
import { $log } from "@tsed/logger";
|
|
4
5
|
import { getOperationsRoutes, JsonEntityStore } from "@tsed/schema";
|
|
5
6
|
import { ServerlessContext } from "../domain/ServerlessContext.js";
|
|
@@ -14,10 +15,10 @@ export class PlatformServerless {
|
|
|
14
15
|
this.name = "PlatformServerless";
|
|
15
16
|
}
|
|
16
17
|
get injector() {
|
|
17
|
-
return
|
|
18
|
+
return injector();
|
|
18
19
|
}
|
|
19
20
|
get settings() {
|
|
20
|
-
return
|
|
21
|
+
return configuration();
|
|
21
22
|
}
|
|
22
23
|
get promise() {
|
|
23
24
|
return this._promise;
|
|
@@ -60,7 +61,7 @@ export class PlatformServerless {
|
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
callbacks(tokens = [], callbacks = {}) {
|
|
63
|
-
return
|
|
64
|
+
return configuration()
|
|
64
65
|
.get("lambda", [])
|
|
65
66
|
.concat(tokens)
|
|
66
67
|
.reduce((callbacks, token) => {
|
|
@@ -81,11 +82,10 @@ export class PlatformServerless {
|
|
|
81
82
|
}, callbacks);
|
|
82
83
|
}
|
|
83
84
|
async ready() {
|
|
84
|
-
await
|
|
85
|
+
await $asyncEmit("$onReady");
|
|
85
86
|
}
|
|
86
87
|
async stop() {
|
|
87
|
-
await
|
|
88
|
-
return this.injector.destroy();
|
|
88
|
+
await destroyInjector();
|
|
89
89
|
}
|
|
90
90
|
init() {
|
|
91
91
|
if (!this._promise) {
|
|
@@ -107,8 +107,6 @@ export class PlatformServerless {
|
|
|
107
107
|
context,
|
|
108
108
|
responseStream,
|
|
109
109
|
id: getRequestId(event, context),
|
|
110
|
-
logger: this.injector.logger,
|
|
111
|
-
injector: this.injector,
|
|
112
110
|
endpoint: entity
|
|
113
111
|
});
|
|
114
112
|
return handler($ctx);
|
|
@@ -133,21 +131,19 @@ export class PlatformServerless {
|
|
|
133
131
|
return this._router;
|
|
134
132
|
}
|
|
135
133
|
createInjector(settings) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.injector.settings.set(settings);
|
|
134
|
+
injector().logger = $log;
|
|
135
|
+
injector().settings.set(settings);
|
|
139
136
|
// istanbul ignore next
|
|
140
|
-
if (
|
|
137
|
+
if (constant("env") === Env.TEST && !settings?.logger?.level) {
|
|
141
138
|
$log.stop();
|
|
142
139
|
}
|
|
143
140
|
return this;
|
|
144
141
|
}
|
|
145
142
|
async loadInjector() {
|
|
146
143
|
const container = createContainer();
|
|
147
|
-
setLoggerConfiguration(
|
|
148
|
-
await
|
|
149
|
-
await
|
|
150
|
-
await this.injector.emit("$afterInit");
|
|
144
|
+
setLoggerConfiguration();
|
|
145
|
+
await injector().load(container);
|
|
146
|
+
await $asyncEmit("$afterInit");
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
149
|
//# sourceMappingURL=PlatformServerless.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformServerless.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerless.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAO,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,CAAC;IACtB,CAAC;IAES,cAAc,CAAC,QAAa;QACpC,QAAQ,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;QACzB,QAAQ,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAElC,uBAAuB;QACvB,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YAC7D,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,YAAY;QAC1B,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;QAEpC,sBAAsB,EAAE,CAAC;QAEzB,MAAM,QAAQ,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEjC,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
1
|
import { pipeline } from "node:stream/promises";
|
|
3
2
|
import { AnyToPromise, isSerializable, isStream } from "@tsed/core";
|
|
4
|
-
import {
|
|
3
|
+
import { inject, injectable, lazyInject, ProviderScope, runInContext } from "@tsed/di";
|
|
4
|
+
import { $asyncEmit } from "@tsed/hooks";
|
|
5
5
|
import { serialize } from "@tsed/json-mapper";
|
|
6
6
|
import { DeserializerPipe, PlatformParams, ValidationPipe } from "@tsed/platform-params";
|
|
7
7
|
import { ServerlessResponseStream } from "../domain/ServerlessResponseStream.js";
|
|
8
8
|
import { setResponseHeaders } from "../utils/setResponseHeaders.js";
|
|
9
|
-
|
|
9
|
+
export class PlatformServerlessHandler {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.params = inject(PlatformParams);
|
|
12
|
+
}
|
|
10
13
|
createHandler(token, propertyKey) {
|
|
11
14
|
const promisedHandler = this.params.compileHandler({ token, propertyKey });
|
|
12
15
|
return ($ctx) => {
|
|
13
16
|
return runInContext($ctx, async () => {
|
|
14
|
-
await
|
|
17
|
+
await $asyncEmit("$onRequest", $ctx);
|
|
15
18
|
try {
|
|
16
19
|
const resolver = new AnyToPromise();
|
|
17
20
|
const handler = await promisedHandler;
|
|
@@ -20,7 +23,7 @@ let PlatformServerlessHandler = class PlatformServerlessHandler {
|
|
|
20
23
|
}
|
|
21
24
|
catch (er) {
|
|
22
25
|
$ctx.response.status(500).body(er);
|
|
23
|
-
const exceptions = await
|
|
26
|
+
const exceptions = await lazyInject(() => import("@tsed/platform-exceptions"));
|
|
24
27
|
await exceptions.catch(er, $ctx);
|
|
25
28
|
}
|
|
26
29
|
return this.flush($ctx);
|
|
@@ -29,7 +32,7 @@ let PlatformServerlessHandler = class PlatformServerlessHandler {
|
|
|
29
32
|
}
|
|
30
33
|
async flush($ctx) {
|
|
31
34
|
const body = $ctx.isHttpEvent() && !$ctx.isAuthorizerEvent() ? await this.makeHttpResponse($ctx) : $ctx.response.getBody();
|
|
32
|
-
await
|
|
35
|
+
await $asyncEmit("$onResponse", $ctx);
|
|
33
36
|
$ctx.logger.flush();
|
|
34
37
|
$ctx.destroy();
|
|
35
38
|
if (!$ctx.isHttpEvent() && $ctx.response.statusCode >= 400 && body) {
|
|
@@ -87,24 +90,6 @@ let PlatformServerlessHandler = class PlatformServerlessHandler {
|
|
|
87
90
|
$ctx.response.body(data);
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
Inject(),
|
|
93
|
-
__metadata("design:type", InjectorService)
|
|
94
|
-
], PlatformServerlessHandler.prototype, "injector", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
Inject(),
|
|
97
|
-
__metadata("design:type", PlatformParams)
|
|
98
|
-
], PlatformServerlessHandler.prototype, "params", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
LazyInject(() => import("@tsed/platform-exceptions")),
|
|
101
|
-
__metadata("design:type", Promise)
|
|
102
|
-
], PlatformServerlessHandler.prototype, "exceptionsManager", void 0);
|
|
103
|
-
PlatformServerlessHandler = __decorate([
|
|
104
|
-
Injectable({
|
|
105
|
-
scope: ProviderScope.SINGLETON,
|
|
106
|
-
imports: [DeserializerPipe, ValidationPipe]
|
|
107
|
-
})
|
|
108
|
-
], PlatformServerlessHandler);
|
|
109
|
-
export { PlatformServerlessHandler };
|
|
93
|
+
}
|
|
94
|
+
injectable(PlatformServerlessHandler).scope(ProviderScope.SINGLETON).imports([DeserializerPipe, ValidationPipe]);
|
|
110
95
|
//# sourceMappingURL=PlatformServerlessHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformServerlessHandler.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlatformServerlessHandler.js","sourceRoot":"","sources":["../../../src/builder/PlatformServerlessHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAmB,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpF,OAAO,EAAc,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AACjH,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAIvF,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE,MAAM,OAAO,yBAAyB;IAAtC;QACY,WAAM,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IAwG5C,CAAC;IAtGC,aAAa,CAAC,KAAoB,EA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
export declare class PlatformServerless {
|
|
14
14
|
readonly name: string;
|
|
15
|
-
private _injector;
|
|
16
15
|
private _router;
|
|
17
16
|
private _promise;
|
|
18
17
|
get injector(): InjectorService;
|
|
19
|
-
get settings(): import("@tsed/di").DIConfiguration;
|
|
18
|
+
get settings(): TsED.DIConfiguration & import("@tsed/di").DIConfiguration;
|
|
20
19
|
get promise(): Promise<any>;
|
|
21
20
|
static bootstrap(settings?: Partial<TsED.Configuration> & {
|
|
22
21
|
lambda?: Type[];
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
1
|
+
import { TokenProvider } from "@tsed/di";
|
|
3
2
|
import { PlatformParams } from "@tsed/platform-params";
|
|
4
3
|
import { ServerlessContext } from "../domain/ServerlessContext.js";
|
|
5
4
|
import type { ServerlessEvent } from "../domain/ServerlessEvent.js";
|
|
6
5
|
export declare class PlatformServerlessHandler {
|
|
7
|
-
protected injector: InjectorService;
|
|
8
6
|
protected params: PlatformParams;
|
|
9
|
-
protected exceptionsManager: Promise<PlatformExceptions>;
|
|
10
7
|
createHandler(token: TokenProvider, propertyKey: string | symbol): ($ctx: ServerlessContext<ServerlessEvent>) => Promise<Promise<unknown>>;
|
|
11
8
|
private flush;
|
|
12
9
|
private makeHttpResponse;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/platform-serverless",
|
|
3
3
|
"description": "Platform serverless module for Ts.ED Framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.0.0-rc.
|
|
5
|
+
"version": "8.0.0-rc.6",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -22,21 +22,23 @@
|
|
|
22
22
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tsed/core": "8.0.0-rc.
|
|
26
|
-
"@tsed/
|
|
27
|
-
"@tsed/
|
|
28
|
-
"@tsed/
|
|
29
|
-
"@tsed/
|
|
30
|
-
"@tsed/
|
|
25
|
+
"@tsed/core": "8.0.0-rc.6",
|
|
26
|
+
"@tsed/di": "8.0.0-rc.6",
|
|
27
|
+
"@tsed/exceptions": "8.0.0-rc.6",
|
|
28
|
+
"@tsed/hooks": "8.0.0-rc.6",
|
|
29
|
+
"@tsed/json-mapper": "8.0.0-rc.6",
|
|
30
|
+
"@tsed/platform-exceptions": "8.0.0-rc.6",
|
|
31
|
+
"@tsed/platform-params": "8.0.0-rc.6",
|
|
32
|
+
"@tsed/schema": "8.0.0-rc.6",
|
|
31
33
|
"encodeurl": "^2.0.0",
|
|
32
34
|
"mime": "^4.0.4",
|
|
33
35
|
"tslib": "2.7.0",
|
|
34
36
|
"uuid": "^10.0.0"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@tsed/barrels": "8.0.0-rc.
|
|
38
|
-
"@tsed/platform-serverless-testing": "8.0.0-rc.
|
|
39
|
-
"@tsed/typescript": "8.0.0-rc.
|
|
39
|
+
"@tsed/barrels": "8.0.0-rc.6",
|
|
40
|
+
"@tsed/platform-serverless-testing": "8.0.0-rc.6",
|
|
41
|
+
"@tsed/typescript": "8.0.0-rc.6",
|
|
40
42
|
"@types/aws-lambda": "^8.10.145",
|
|
41
43
|
"@types/encodeurl": "^1.0.2",
|
|
42
44
|
"@types/mime": "^4.0.0",
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
"vitest": "2.1.2"
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
|
-
"@tsed/di": "8.0.0-rc.
|
|
51
|
+
"@tsed/di": "8.0.0-rc.6",
|
|
50
52
|
"@tsed/logger": ">=6.7.5",
|
|
51
53
|
"find-my-way": ">=7.0.0"
|
|
52
54
|
},
|
package/vitest.config.mts
CHANGED
|
@@ -10,10 +10,10 @@ export default defineConfig(
|
|
|
10
10
|
coverage: {
|
|
11
11
|
...presets.test.coverage,
|
|
12
12
|
thresholds: {
|
|
13
|
-
statements: 98.
|
|
14
|
-
branches:
|
|
15
|
-
functions:
|
|
16
|
-
lines: 98.
|
|
13
|
+
statements: 98.2,
|
|
14
|
+
branches: 96.34,
|
|
15
|
+
functions: 98.75,
|
|
16
|
+
lines: 98.2
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|