@tsed/common 6.75.8 → 6.75.12
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 -1
- package/lib/decorators/params/endpointInfo.d.ts +4 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +17 -28
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +19 -30
- package/lib/index.modern.js.map +1 -1
- package/package.json +17 -16
|
@@ -105,5 +105,4 @@ export declare abstract class PlatformBuilder<App = TsED.Application, Router = T
|
|
|
105
105
|
protected logRoutes(): Promise<void>;
|
|
106
106
|
protected loadRoutes(): Promise<void>;
|
|
107
107
|
protected createInjector(module: Type<any>, settings: any): void;
|
|
108
|
-
protected createRootModule(module: Type<any>): void;
|
|
109
108
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EndpointMetadata } from "../../domain/EndpointMetadata";
|
|
2
|
-
export declare type EndpointInfo = EndpointMetadata;
|
|
3
2
|
/**
|
|
4
3
|
* Get the current endpoint metadata.
|
|
5
4
|
* @decorator
|
|
@@ -8,3 +7,7 @@ export declare type EndpointInfo = EndpointMetadata;
|
|
|
8
7
|
* @deprecated Use `@Context() $ctx: Context` then `$ctx.endpoint` instead.
|
|
9
8
|
*/
|
|
10
9
|
export declare function EndpointInfo(): Function;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
export declare type EndpointInfo = EndpointMetadata;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var logger = require('@tsed/logger');
|
|
2
|
+
require('@tsed/logger-file');
|
|
1
3
|
var di = require('@tsed/di');
|
|
2
4
|
var platformParams = require('@tsed/platform-params');
|
|
3
5
|
var platformExceptions = require('@tsed/platform-exceptions');
|
|
@@ -7,7 +9,6 @@ var platformMiddlewares = require('@tsed/platform-middlewares');
|
|
|
7
9
|
var platformViews = require('@tsed/platform-views');
|
|
8
10
|
var componentsScan = require('@tsed/components-scan');
|
|
9
11
|
var platformLogMiddleware = require('@tsed/platform-log-middleware');
|
|
10
|
-
var logger = require('@tsed/logger');
|
|
11
12
|
var tslib = require('tslib');
|
|
12
13
|
var core = require('@tsed/core');
|
|
13
14
|
var perf = require('@tsed/perf');
|
|
@@ -1565,7 +1566,7 @@ exports.PlatformRequest = class PlatformRequest {
|
|
|
1565
1566
|
}
|
|
1566
1567
|
|
|
1567
1568
|
get rawBody() {
|
|
1568
|
-
return this.raw.rawBody;
|
|
1569
|
+
return this.raw.rawBody || this.raw.body;
|
|
1569
1570
|
}
|
|
1570
1571
|
/**
|
|
1571
1572
|
* When using `cookie-parser` middleware, this property is an object that contains cookies sent by the request.
|
|
@@ -2679,7 +2680,6 @@ function getStaticsOptions(statics) {
|
|
|
2679
2680
|
}, []);
|
|
2680
2681
|
}
|
|
2681
2682
|
|
|
2682
|
-
const SKIP_HOOKS = ["$beforeInit", "$afterInit", "$onInit", "$onMountingMiddlewares"];
|
|
2683
2683
|
const {
|
|
2684
2684
|
bind,
|
|
2685
2685
|
start,
|
|
@@ -2690,26 +2690,26 @@ const {
|
|
|
2690
2690
|
* @platform
|
|
2691
2691
|
*/
|
|
2692
2692
|
|
|
2693
|
-
var _rootModule = /*#__PURE__*/_classPrivateFieldLooseKey("rootModule");
|
|
2694
|
-
|
|
2695
2693
|
var _injector = /*#__PURE__*/_classPrivateFieldLooseKey("injector");
|
|
2696
2694
|
|
|
2697
2695
|
var _providers = /*#__PURE__*/_classPrivateFieldLooseKey("providers");
|
|
2698
2696
|
|
|
2697
|
+
var _rootModule = /*#__PURE__*/_classPrivateFieldLooseKey("rootModule");
|
|
2698
|
+
|
|
2699
2699
|
class PlatformBuilder {
|
|
2700
2700
|
constructor({
|
|
2701
2701
|
name,
|
|
2702
2702
|
providers
|
|
2703
2703
|
}) {
|
|
2704
|
-
Object.defineProperty(this,
|
|
2704
|
+
Object.defineProperty(this, _injector, {
|
|
2705
2705
|
writable: true,
|
|
2706
2706
|
value: void 0
|
|
2707
2707
|
});
|
|
2708
|
-
Object.defineProperty(this,
|
|
2708
|
+
Object.defineProperty(this, _providers, {
|
|
2709
2709
|
writable: true,
|
|
2710
2710
|
value: void 0
|
|
2711
2711
|
});
|
|
2712
|
-
Object.defineProperty(this,
|
|
2712
|
+
Object.defineProperty(this, _rootModule, {
|
|
2713
2713
|
writable: true,
|
|
2714
2714
|
value: void 0
|
|
2715
2715
|
});
|
|
@@ -2726,7 +2726,7 @@ class PlatformBuilder {
|
|
|
2726
2726
|
}
|
|
2727
2727
|
|
|
2728
2728
|
get rootModule() {
|
|
2729
|
-
return _classPrivateFieldLooseBase(this, _rootModule)[_rootModule];
|
|
2729
|
+
return _classPrivateFieldLooseBase(this, _injector)[_injector].get(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule]);
|
|
2730
2730
|
}
|
|
2731
2731
|
|
|
2732
2732
|
get app() {
|
|
@@ -2833,9 +2833,12 @@ class PlatformBuilder {
|
|
|
2833
2833
|
const {
|
|
2834
2834
|
injector
|
|
2835
2835
|
} = this;
|
|
2836
|
-
await this.callHook("$beforeInit");
|
|
2837
2836
|
this.log("Build providers");
|
|
2838
|
-
const container = di.createContainer(
|
|
2837
|
+
const container = di.createContainer();
|
|
2838
|
+
container.addProvider(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule], {
|
|
2839
|
+
type: "server:module",
|
|
2840
|
+
scope: di.ProviderScope.SINGLETON
|
|
2841
|
+
});
|
|
2839
2842
|
await injector.load(container);
|
|
2840
2843
|
this.log("Settings and injector loaded");
|
|
2841
2844
|
await this.callHook("$afterInit");
|
|
@@ -2865,26 +2868,18 @@ class PlatformBuilder {
|
|
|
2865
2868
|
|
|
2866
2869
|
async callHook(hook, ...args) {
|
|
2867
2870
|
const {
|
|
2868
|
-
injector
|
|
2869
|
-
rootModule
|
|
2871
|
+
injector
|
|
2870
2872
|
} = this;
|
|
2871
2873
|
log(hook);
|
|
2872
2874
|
|
|
2873
2875
|
if (!this.disableBootstrapLog) {
|
|
2874
2876
|
injector.logger.info(`\x1B[1mCall hook ${hook}\x1B[22m`);
|
|
2875
|
-
} // call hook for the Server
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
if (hook in rootModule) {
|
|
2879
|
-
await rootModule[hook](...args);
|
|
2880
2877
|
} // Load middlewares for the given hook
|
|
2881
2878
|
|
|
2882
2879
|
|
|
2883
2880
|
this.loadMiddlewaresFor(hook); // call hooks added by providers
|
|
2884
2881
|
|
|
2885
|
-
|
|
2886
|
-
await injector.emit(hook);
|
|
2887
|
-
}
|
|
2882
|
+
await injector.emit(hook);
|
|
2888
2883
|
}
|
|
2889
2884
|
|
|
2890
2885
|
async loadStatics(hook) {
|
|
@@ -2954,7 +2949,6 @@ class PlatformBuilder {
|
|
|
2954
2949
|
this.createInjector(module, _extends({}, settings, {
|
|
2955
2950
|
PLATFORM_NAME: this.name
|
|
2956
2951
|
}));
|
|
2957
|
-
this.createRootModule(module);
|
|
2958
2952
|
await this.runLifecycle();
|
|
2959
2953
|
return this;
|
|
2960
2954
|
}
|
|
@@ -3003,6 +2997,7 @@ class PlatformBuilder {
|
|
|
3003
2997
|
}
|
|
3004
2998
|
|
|
3005
2999
|
createInjector(module, settings) {
|
|
3000
|
+
_classPrivateFieldLooseBase(this, _rootModule)[_rootModule] = module;
|
|
3006
3001
|
const configuration = di.getConfiguration(module, settings);
|
|
3007
3002
|
_classPrivateFieldLooseBase(this, _injector)[_injector] = createInjector(configuration); // configure locals providers
|
|
3008
3003
|
|
|
@@ -3014,12 +3009,6 @@ class PlatformBuilder {
|
|
|
3014
3009
|
createHttpServer(this.injector);
|
|
3015
3010
|
}
|
|
3016
3011
|
|
|
3017
|
-
createRootModule(module) {
|
|
3018
|
-
_classPrivateFieldLooseBase(this, _rootModule)[_rootModule] = this.injector.invoke(module);
|
|
3019
|
-
this.injector.delete(core.constructorOf(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule]));
|
|
3020
|
-
this.injector.delete(core.classOf(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule]));
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
3012
|
}
|
|
3024
3013
|
|
|
3025
3014
|
/**
|