@tsed/platform-http 8.16.0-rc.1 → 8.16.0-rc.3
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/common/builder/PlatformBuilder.js +21 -61
- package/lib/esm/common/config/PlatformConfiguration.js +5 -0
- package/lib/esm/common/config/defineConfiguration.js +44 -0
- package/lib/esm/common/index.js +4 -5
- package/lib/esm/common/middlewares/PlatformAcceptMimesMiddleware.js +3 -33
- package/lib/esm/common/utils/createInjector.js +2 -6
- package/lib/esm/common/utils/getBestHost.js +35 -0
- package/lib/esm/testing/PlatformTest.js +15 -16
- package/lib/types/common/builder/PlatformBuilder.d.ts +10 -12
- package/lib/types/common/config/PlatformConfiguration.d.ts +34 -0
- package/lib/types/common/config/{interfaces/PlatformStaticsSettings.d.ts → PlatformStaticsSettings.d.ts} +0 -9
- package/lib/types/common/config/defineConfiguration.d.ts +2 -0
- package/lib/types/common/index.d.ts +4 -5
- package/lib/types/common/middlewares/PlatformAcceptMimesMiddleware.d.ts +3 -15
- package/lib/types/common/services/PlatformAdapter.d.ts +1 -1
- package/lib/types/common/utils/getBestHost.d.ts +39 -0
- package/lib/types/common/utils/getStaticsOptions.d.ts +1 -1
- package/lib/types/testing/FakeAdapter.d.ts +2 -2
- package/lib/types/testing/PlatformTest.d.ts +6 -6
- package/package.json +21 -20
- package/lib/esm/common/config/interfaces/PlatformJsonMapperSettings.js +0 -1
- package/lib/esm/common/config/interfaces/PlatformMulterSettings.js +0 -1
- package/lib/esm/common/config/interfaces/PlatformRouterSettings.js +0 -1
- package/lib/esm/common/config/services/PlatformConfiguration.js +0 -118
- package/lib/esm/common/utils/getConfiguration.js +0 -31
- package/lib/types/common/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
- package/lib/types/common/config/interfaces/PlatformMulterSettings.d.ts +0 -17
- package/lib/types/common/config/interfaces/PlatformRouterSettings.d.ts +0 -10
- package/lib/types/common/config/services/PlatformConfiguration.d.ts +0 -78
- package/lib/types/common/utils/getConfiguration.d.ts +0 -2
- /package/lib/esm/common/config/{interfaces/PlatformStaticsSettings.js → PlatformStaticsSettings.js} +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { colors, configuration, constant, createContainer, destroyInjector, injector, logger, ProviderScope
|
|
3
|
-
import { $asyncAlter, $asyncEmit } from "@tsed/hooks";
|
|
4
|
-
import {
|
|
1
|
+
import "@tsed/platform-accept-mimes";
|
|
2
|
+
import { colors, configuration, constant, createContainer, destroyInjector, injector, logger, ProviderScope } from "@tsed/di";
|
|
3
|
+
import { $alter, $asyncAlter, $asyncEmit } from "@tsed/hooks";
|
|
4
|
+
import { defineConfiguration } from "../config/defineConfiguration.js";
|
|
5
5
|
import { application } from "../fn/application.js";
|
|
6
6
|
import { Platform } from "../services/Platform.js";
|
|
7
7
|
import { PlatformAdapter } from "../services/PlatformAdapter.js";
|
|
8
8
|
import { PlatformApplication } from "../services/PlatformApplication.js";
|
|
9
9
|
import { closeServer } from "../utils/closeServer.js";
|
|
10
10
|
import { createInjector } from "../utils/createInjector.js";
|
|
11
|
-
import { getConfiguration } from "../utils/getConfiguration.js";
|
|
12
11
|
import { getStaticsOptions } from "../utils/getStaticsOptions.js";
|
|
13
12
|
import { printRoutes } from "../utils/printRoutes.js";
|
|
14
13
|
import { resolveControllers } from "../utils/resolveControllers.js";
|
|
@@ -25,8 +24,10 @@ export class PlatformBuilder {
|
|
|
25
24
|
this.current = new Date();
|
|
26
25
|
this.#listeners = [];
|
|
27
26
|
this.#rootModule = module;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
createInjector(defineConfiguration({
|
|
28
|
+
rootModule: module,
|
|
29
|
+
...settings
|
|
30
|
+
}));
|
|
30
31
|
this.log(`Loading ${this.name.toUpperCase()} platform adapter...`);
|
|
31
32
|
this.createHttpServers();
|
|
32
33
|
this.log("Injector created...");
|
|
@@ -51,20 +52,18 @@ export class PlatformBuilder {
|
|
|
51
52
|
*
|
|
52
53
|
* ```typescript
|
|
53
54
|
* @Configuration({
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* port: 8000,
|
|
56
|
+
* httpsPort: 8080,
|
|
57
|
+
* mount: {
|
|
58
|
+
* "/rest": "${rootDir}/controllers/**\/*.js"
|
|
59
|
+
* }
|
|
59
60
|
* })
|
|
60
61
|
* export class Server {
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* $onInit(){
|
|
63
|
+
* console.log(this.settings); // {rootDir, port, httpsPort,...}
|
|
64
|
+
* }
|
|
64
65
|
* }
|
|
65
66
|
* ```
|
|
66
|
-
*
|
|
67
|
-
* @returns {PlatformConfiguration}
|
|
68
67
|
*/
|
|
69
68
|
get settings() {
|
|
70
69
|
return configuration();
|
|
@@ -127,15 +126,12 @@ export class PlatformBuilder {
|
|
|
127
126
|
*/
|
|
128
127
|
addControllers(endpoint, controllers) {
|
|
129
128
|
[].concat(controllers).forEach((token) => {
|
|
130
|
-
configuration().routes.push({ token, route: endpoint });
|
|
129
|
+
configuration().get("routes").push({ token, route: endpoint });
|
|
131
130
|
});
|
|
132
131
|
}
|
|
133
132
|
async runLifecycle() {
|
|
134
133
|
// init adapter (Express, Koa, etc...)
|
|
135
134
|
await this.adapter.onInit();
|
|
136
|
-
setLoggerConfiguration();
|
|
137
|
-
// create the middleware mapping to be executed to the expected hook
|
|
138
|
-
await this.mapTokenMiddlewares();
|
|
139
135
|
await this.loadInjector();
|
|
140
136
|
// add the context middleware to the application
|
|
141
137
|
this.log("Mount app context");
|
|
@@ -166,7 +162,8 @@ export class PlatformBuilder {
|
|
|
166
162
|
async loadInjector() {
|
|
167
163
|
this.log("Build providers");
|
|
168
164
|
const settings = configuration();
|
|
169
|
-
|
|
165
|
+
const routes = settings.get("routes").concat(resolveControllers(settings));
|
|
166
|
+
settings.set("routes", routes);
|
|
170
167
|
const container = createContainer();
|
|
171
168
|
container.delete(this.#rootModule);
|
|
172
169
|
container.addProvider(this.#rootModule, {
|
|
@@ -244,7 +241,8 @@ export class PlatformBuilder {
|
|
|
244
241
|
* @protected
|
|
245
242
|
*/
|
|
246
243
|
loadMiddlewaresFor(hook) {
|
|
247
|
-
|
|
244
|
+
const middlewares = $alter("$alterMiddlewaresForHook", constant("middlewares", []), [hook]);
|
|
245
|
+
return middlewares.forEach(({ use }) => {
|
|
248
246
|
this.app.use(use);
|
|
249
247
|
});
|
|
250
248
|
}
|
|
@@ -269,42 +267,4 @@ export class PlatformBuilder {
|
|
|
269
267
|
logger().info(printRoutes(await $asyncAlter("$logRoutes", routes)));
|
|
270
268
|
}
|
|
271
269
|
}
|
|
272
|
-
async mapTokenMiddlewares() {
|
|
273
|
-
let middlewares = constant("middlewares", []);
|
|
274
|
-
const env = constant("env");
|
|
275
|
-
const defaultHook = "$beforeRoutesInit";
|
|
276
|
-
const promises = middlewares.map(async (middleware) => {
|
|
277
|
-
if (isFunction(middleware)) {
|
|
278
|
-
return {
|
|
279
|
-
env,
|
|
280
|
-
hook: defaultHook,
|
|
281
|
-
use: middleware
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
if (isString(middleware)) {
|
|
285
|
-
middleware = { env, use: middleware, hook: defaultHook };
|
|
286
|
-
}
|
|
287
|
-
let { use, options } = middleware;
|
|
288
|
-
if (isString(use)) {
|
|
289
|
-
if (["text-parser", "raw-parser", "json-parser", "urlencoded-parser"].includes(use)) {
|
|
290
|
-
use = this.adapter.bodyParser(use.replace("-parser", ""), options);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
const mod = await import(use);
|
|
294
|
-
use = (mod.default || mod)(options);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
if (isClass(use) && ["$beforeInit", "$onInit", "$afterInit"].includes(middleware.hook)) {
|
|
298
|
-
throw new Error(`Ts.ED Middleware "${nameOf(use)}" middleware cannot be added on ${middleware.hook} hook. Use one of this hooks instead: $beforeRoutesInit, $onRoutesInit, $afterRoutesInit, $beforeListen, $afterListen, $onReady`);
|
|
299
|
-
}
|
|
300
|
-
return {
|
|
301
|
-
env,
|
|
302
|
-
hook: defaultHook,
|
|
303
|
-
...middleware,
|
|
304
|
-
use
|
|
305
|
-
};
|
|
306
|
-
});
|
|
307
|
-
middlewares = await Promise.all(promises);
|
|
308
|
-
configuration().set("middlewares", middlewares.filter((middleware) => middleware.use));
|
|
309
|
-
}
|
|
310
270
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "./PlatformConfiguration.js";
|
|
2
|
+
import { Env, isBoolean, Store } from "@tsed/core";
|
|
3
|
+
import { configuration, mergeMount, ProviderScope, ProviderType } from "@tsed/di";
|
|
4
|
+
import { $on } from "@tsed/hooks";
|
|
5
|
+
import { JsonMapperSettings } from "@tsed/json-mapper";
|
|
6
|
+
export function defineConfiguration(input = {}) {
|
|
7
|
+
if (input.$$resolved) {
|
|
8
|
+
return input;
|
|
9
|
+
}
|
|
10
|
+
const store = input.rootModule ? Store.from(input.rootModule).get("configuration") || {} : {};
|
|
11
|
+
const env = input.env || store.env || process.env.NODE_ENV || Env.DEV;
|
|
12
|
+
const finalConfig = {
|
|
13
|
+
$$resolved: true,
|
|
14
|
+
rootDir: process.cwd(),
|
|
15
|
+
env,
|
|
16
|
+
httpPort: 8080,
|
|
17
|
+
httpsPort: false,
|
|
18
|
+
jsonMapper: JsonMapperSettings,
|
|
19
|
+
...store,
|
|
20
|
+
...input,
|
|
21
|
+
scopes: {
|
|
22
|
+
[ProviderType.CONTROLLER]: ProviderScope.SINGLETON,
|
|
23
|
+
...store.scopes,
|
|
24
|
+
...input.scopes
|
|
25
|
+
},
|
|
26
|
+
mount: mergeMount(store.mount, input.mount),
|
|
27
|
+
logger: {
|
|
28
|
+
debug: false,
|
|
29
|
+
level: env === Env.TEST ? "off" : "info",
|
|
30
|
+
logRequest: true,
|
|
31
|
+
...store.logger,
|
|
32
|
+
...input.logger,
|
|
33
|
+
jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
configuration().set(finalConfig);
|
|
37
|
+
return finalConfig;
|
|
38
|
+
}
|
|
39
|
+
$on("$alterConfig:jsonMapper", (options) => {
|
|
40
|
+
JsonMapperSettings.strictGroups = Boolean(options.strictGroups);
|
|
41
|
+
JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
|
|
42
|
+
JsonMapperSettings.additionalProperties = Boolean(isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
|
|
43
|
+
return options;
|
|
44
|
+
});
|
package/lib/esm/common/index.js
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @file Automatically generated by @tsed/barrels.
|
|
3
3
|
*/
|
|
4
4
|
export * from "./builder/PlatformBuilder.js";
|
|
5
|
-
export * from "./config/
|
|
6
|
-
export * from "./config/
|
|
7
|
-
export * from "./config/
|
|
8
|
-
export * from "./config/interfaces/PlatformStaticsSettings.js";
|
|
9
|
-
export * from "./config/services/PlatformConfiguration.js";
|
|
5
|
+
export * from "./config/defineConfiguration.js";
|
|
6
|
+
export * from "./config/PlatformConfiguration.js";
|
|
7
|
+
export * from "./config/PlatformStaticsSettings.js";
|
|
10
8
|
export * from "./constants/routerOptions.js";
|
|
11
9
|
export * from "./decorators/multer/multerFileSize.js";
|
|
12
10
|
export * from "./decorators/multer/multerOptions.js";
|
|
@@ -53,6 +51,7 @@ export * from "./utils/createHttpsServer.js";
|
|
|
53
51
|
export * from "./utils/createInjector.js";
|
|
54
52
|
export * from "./utils/createServer.js";
|
|
55
53
|
export * from "./utils/ensureContext.js";
|
|
54
|
+
export * from "./utils/getBestHost.js";
|
|
56
55
|
export * from "./utils/getStaticsOptions.js";
|
|
57
56
|
export * from "./utils/listenServer.js";
|
|
58
57
|
export * from "./utils/mapReturnedResponse.js";
|
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { uniq } from "@tsed/core";
|
|
3
|
-
import { constant, injectable, ProviderType } from "@tsed/di";
|
|
4
|
-
import { NotAcceptable } from "@tsed/exceptions";
|
|
5
|
-
import { Context } from "@tsed/platform-params";
|
|
1
|
+
import { PlatformAcceptMimesMiddleware as M } from "@tsed/platform-accept-mimes";
|
|
6
2
|
/**
|
|
7
|
-
* @
|
|
8
|
-
* @platform
|
|
3
|
+
* @deprecated Since version 8.16. Use PlatformAcceptMiddleware from @tsed/platform-accept-mimes package
|
|
9
4
|
*/
|
|
10
|
-
export
|
|
11
|
-
constructor() {
|
|
12
|
-
this.acceptMimes = constant("acceptMimes", []);
|
|
13
|
-
}
|
|
14
|
-
$alterEndpointHandlers(handlers, operationRoute) {
|
|
15
|
-
const hasAcceptMimes = operationRoute.endpoint.acceptMimes.length || this.acceptMimes.length;
|
|
16
|
-
return {
|
|
17
|
-
...handlers,
|
|
18
|
-
before: [hasAcceptMimes && PlatformAcceptMimesMiddleware, ...handlers.before].filter(Boolean)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
use(ctx) {
|
|
22
|
-
const { endpoint, request } = ctx;
|
|
23
|
-
const mimes = uniq((endpoint?.get("acceptMimes") || []).concat(this.acceptMimes));
|
|
24
|
-
if (mimes.length && !request.accepts(mimes)) {
|
|
25
|
-
throw new NotAcceptable(mimes.join(", "));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
__decorate([
|
|
30
|
-
__param(0, Context()),
|
|
31
|
-
__metadata("design:type", Function),
|
|
32
|
-
__metadata("design:paramtypes", [Object]),
|
|
33
|
-
__metadata("design:returntype", void 0)
|
|
34
|
-
], PlatformAcceptMimesMiddleware.prototype, "use", null);
|
|
35
|
-
injectable(PlatformAcceptMimesMiddleware).type(ProviderType.MIDDLEWARE).priority(-10);
|
|
5
|
+
export const PlatformAcceptMimesMiddleware = M;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { attachLogger, injector } from "@tsed/di";
|
|
2
2
|
import { $log } from "@tsed/logger";
|
|
3
|
-
import { PlatformConfiguration } from "../config/services/PlatformConfiguration.js";
|
|
4
3
|
import { adapter as $adapter } from "../fn/adapter.js";
|
|
5
4
|
import { PlatformAdapter } from "../services/PlatformAdapter.js";
|
|
6
5
|
$log.name = "TSED";
|
|
7
6
|
export function createInjector(settings) {
|
|
8
7
|
const inj = injector();
|
|
9
|
-
inj.addProvider(PlatformConfiguration);
|
|
10
|
-
inj.settings = inj.invoke(PlatformConfiguration);
|
|
11
|
-
inj.logger = $log;
|
|
12
8
|
inj.settings.set(settings);
|
|
13
|
-
|
|
9
|
+
attachLogger($log);
|
|
14
10
|
$adapter(settings.adapter);
|
|
15
11
|
inj.invoke(PlatformAdapter);
|
|
16
12
|
return inj;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getHostInfoFromPort } from "@tsed/core";
|
|
2
|
+
import { configuration, constant } from "@tsed/di";
|
|
3
|
+
function httpPort() {
|
|
4
|
+
return constant("httpPort", constant("port"));
|
|
5
|
+
}
|
|
6
|
+
export function setHttpPort(settings) {
|
|
7
|
+
configuration().set("httpPort", `${settings.address}:${settings.port}`);
|
|
8
|
+
}
|
|
9
|
+
export function setHttpsPort(settings) {
|
|
10
|
+
configuration().set("httpsPort", `${settings.address}:${settings.port}`);
|
|
11
|
+
}
|
|
12
|
+
export function getHttpsPort() {
|
|
13
|
+
return getHostInfoFromPort("https", constant("httpsPort"));
|
|
14
|
+
}
|
|
15
|
+
export function getHttpPort() {
|
|
16
|
+
return getHostInfoFromPort("http", httpPort());
|
|
17
|
+
}
|
|
18
|
+
export function getBestHost() {
|
|
19
|
+
if (constant("httpsPort")) {
|
|
20
|
+
return getHttpsPort();
|
|
21
|
+
}
|
|
22
|
+
if (httpPort()) {
|
|
23
|
+
return getHttpPort();
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
toString() {
|
|
27
|
+
return "/";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
configuration().decorate("getBestHost", getBestHost);
|
|
32
|
+
configuration().decorate("getHttpPort", getHttpPort);
|
|
33
|
+
configuration().decorate("getHttpsPort", getHttpsPort);
|
|
34
|
+
configuration().decorate("setHttpsPort", setHttpsPort);
|
|
35
|
+
configuration().decorate("setHttpPort", setHttpPort);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { isPlainObject } from "@tsed/core";
|
|
1
2
|
import { DITest, injector } from "@tsed/di";
|
|
2
3
|
import accepts from "accepts";
|
|
3
4
|
import { PlatformBuilder } from "../common/builder/PlatformBuilder.js";
|
|
4
5
|
import { PlatformContext } from "../common/domain/PlatformContext.js";
|
|
5
|
-
import { adapter } from "../common/index.js";
|
|
6
|
+
import { adapter, defineConfiguration } from "../common/index.js";
|
|
6
7
|
import { PlatformAdapter } from "../common/services/PlatformAdapter.js";
|
|
7
8
|
import { PlatformApplication } from "../common/services/PlatformApplication.js";
|
|
8
9
|
import { createInjector } from "../common/utils/createInjector.js";
|
|
9
|
-
import { getConfiguration } from "../common/utils/getConfiguration.js";
|
|
10
10
|
import { FakeAdapter } from "./FakeAdapter.js";
|
|
11
11
|
import { FakeResponse } from "./FakeResponse.js";
|
|
12
12
|
/**
|
|
@@ -21,31 +21,30 @@ export class PlatformTest extends DITest {
|
|
|
21
21
|
},
|
|
22
22
|
...(settings.imports || [])
|
|
23
23
|
];
|
|
24
|
-
PlatformTest.createInjector(
|
|
24
|
+
PlatformTest.createInjector(defineConfiguration(DITest.configure(settings)));
|
|
25
25
|
await DITest.createContainer();
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Create a new injector with the right default services
|
|
29
29
|
*/
|
|
30
30
|
static createInjector(settings = {}) {
|
|
31
|
-
return createInjector(
|
|
31
|
+
return createInjector(settings);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
static bootstrap(mod, { listen, ...settings } = {}) {
|
|
33
|
+
static bootstrap(mod, initialSettings = {}) {
|
|
34
|
+
if (!isPlainObject(mod)) {
|
|
35
|
+
initialSettings.rootModule = mod;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
initialSettings = mod;
|
|
39
|
+
}
|
|
40
|
+
const { listen, ...props } = initialSettings;
|
|
42
41
|
return async function before() {
|
|
43
42
|
let instance;
|
|
44
43
|
// @ts-ignore
|
|
45
|
-
settings = DITest.configure(
|
|
44
|
+
const settings = DITest.configure(props);
|
|
46
45
|
adapter(settings.adapter || adapter());
|
|
47
|
-
const configuration =
|
|
48
|
-
instance = await PlatformBuilder.build(
|
|
46
|
+
const configuration = defineConfiguration(settings);
|
|
47
|
+
instance = await PlatformBuilder.build(configuration.rootModule, configuration).bootstrap();
|
|
49
48
|
await instance.listen(!!listen);
|
|
50
49
|
};
|
|
51
50
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import "@tsed/platform-accept-mimes";
|
|
2
3
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
3
4
|
import { Type } from "@tsed/core";
|
|
4
5
|
import { InjectorService, ProviderOpts, TokenProvider } from "@tsed/di";
|
|
@@ -24,22 +25,20 @@ export declare class PlatformBuilder<App = TsED.Application> {
|
|
|
24
25
|
*
|
|
25
26
|
* ```typescript
|
|
26
27
|
* @Configuration({
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* port: 8000,
|
|
29
|
+
* httpsPort: 8080,
|
|
30
|
+
* mount: {
|
|
31
|
+
* "/rest": "${rootDir}/controllers/**\/*.js"
|
|
32
|
+
* }
|
|
32
33
|
* })
|
|
33
34
|
* export class Server {
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* $onInit(){
|
|
36
|
+
* console.log(this.settings); // {rootDir, port, httpsPort,...}
|
|
37
|
+
* }
|
|
37
38
|
* }
|
|
38
39
|
* ```
|
|
39
|
-
*
|
|
40
|
-
* @returns {PlatformConfiguration}
|
|
41
40
|
*/
|
|
42
|
-
get settings(): TsED.
|
|
41
|
+
get settings(): TsED.Configuration & import("@tsed/di").DIConfiguration;
|
|
43
42
|
get logger(): import("@tsed/di").DILogger;
|
|
44
43
|
get disableBootstrapLog(): boolean | undefined;
|
|
45
44
|
/**
|
|
@@ -98,5 +97,4 @@ export declare class PlatformBuilder<App = TsED.Application> {
|
|
|
98
97
|
protected createHttpServers(): void;
|
|
99
98
|
protected listenServers(): Promise<void>;
|
|
100
99
|
protected logRoutes(layers: PlatformLayer[]): Promise<void>;
|
|
101
|
-
protected mapTokenMiddlewares(): Promise<void>;
|
|
102
100
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Type } from "@tsed/core";
|
|
2
|
+
import { DIConfiguration } from "@tsed/di";
|
|
3
|
+
import { JsonMapperGlobalOptions } from "@tsed/json-mapper";
|
|
4
|
+
import type { PlatformStaticsSettings } from "./PlatformStaticsSettings.js";
|
|
5
|
+
export interface PlatformRouterSettings {
|
|
6
|
+
appendChildrenRoutesFirst?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
namespace TsED {
|
|
10
|
+
interface Configuration {
|
|
11
|
+
rootModule?: Type;
|
|
12
|
+
rootDir?: string;
|
|
13
|
+
httpPort?: string | number | false;
|
|
14
|
+
httpsPort?: string | number | false;
|
|
15
|
+
jsonMapper?: JsonMapperGlobalOptions;
|
|
16
|
+
router?: PlatformRouterSettings;
|
|
17
|
+
statics?: PlatformStaticsSettings;
|
|
18
|
+
}
|
|
19
|
+
interface StaticsOptions {
|
|
20
|
+
root: string;
|
|
21
|
+
hook?: "$beforeRoutesInit" | "$afterRoutesInit";
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
interface MultipartFileOptions {
|
|
25
|
+
}
|
|
26
|
+
interface MultipartFileInstance {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated
|
|
32
|
+
*/
|
|
33
|
+
export declare const PlatformConfiguration: typeof DIConfiguration;
|
|
34
|
+
export type PlatformConfiguration = DIConfiguration & TsED.Configuration;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace TsED {
|
|
3
|
-
interface StaticsOptions {
|
|
4
|
-
root: string;
|
|
5
|
-
hook?: "$beforeRoutesInit" | "$afterRoutesInit";
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
1
|
export interface PlatformStaticsOptions extends TsED.StaticsOptions {
|
|
11
2
|
root: string;
|
|
12
3
|
[key: string]: any;
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @file Automatically generated by @tsed/barrels.
|
|
3
3
|
*/
|
|
4
4
|
export * from "./builder/PlatformBuilder.js";
|
|
5
|
-
export * from "./config/
|
|
6
|
-
export * from "./config/
|
|
7
|
-
export * from "./config/
|
|
8
|
-
export * from "./config/interfaces/PlatformStaticsSettings.js";
|
|
9
|
-
export * from "./config/services/PlatformConfiguration.js";
|
|
5
|
+
export * from "./config/defineConfiguration.js";
|
|
6
|
+
export * from "./config/PlatformConfiguration.js";
|
|
7
|
+
export * from "./config/PlatformStaticsSettings.js";
|
|
10
8
|
export * from "./constants/routerOptions.js";
|
|
11
9
|
export * from "./decorators/multer/multerFileSize.js";
|
|
12
10
|
export * from "./decorators/multer/multerOptions.js";
|
|
@@ -53,6 +51,7 @@ export * from "./utils/createHttpsServer.js";
|
|
|
53
51
|
export * from "./utils/createInjector.js";
|
|
54
52
|
export * from "./utils/createServer.js";
|
|
55
53
|
export * from "./utils/ensureContext.js";
|
|
54
|
+
export * from "./utils/getBestHost.js";
|
|
56
55
|
export * from "./utils/getStaticsOptions.js";
|
|
57
56
|
export * from "./utils/listenServer.js";
|
|
58
57
|
export * from "./utils/mapReturnedResponse.js";
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Context } from "@tsed/platform-params";
|
|
3
|
-
import type { AlterEndpointHandlersArg } from "@tsed/platform-router";
|
|
4
|
-
import type { JsonOperationRoute } from "@tsed/schema";
|
|
1
|
+
import { PlatformAcceptMimesMiddleware as M } from "@tsed/platform-accept-mimes";
|
|
5
2
|
/**
|
|
6
|
-
* @
|
|
7
|
-
* @platform
|
|
3
|
+
* @deprecated Since version 8.16. Use PlatformAcceptMiddleware from @tsed/platform-accept-mimes package
|
|
8
4
|
*/
|
|
9
|
-
export declare
|
|
10
|
-
protected acceptMimes: string[];
|
|
11
|
-
$alterEndpointHandlers(handlers: AlterEndpointHandlersArg, operationRoute: JsonOperationRoute): {
|
|
12
|
-
before: any[];
|
|
13
|
-
endpoint: import("@tsed/schema").JsonMethodStore;
|
|
14
|
-
after: (Function | import("@tsed/core").Type<any>)[];
|
|
15
|
-
};
|
|
16
|
-
use(ctx: Context): void;
|
|
17
|
-
}
|
|
5
|
+
export declare const PlatformAcceptMimesMiddleware: typeof M;
|
|
@@ -3,7 +3,7 @@ import { IncomingMessage, ServerResponse } from "node:http";
|
|
|
3
3
|
import { Type } from "@tsed/core";
|
|
4
4
|
import type { PlatformMulter, PlatformMulterSettings } from "@tsed/platform-multer";
|
|
5
5
|
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
6
|
-
import { PlatformStaticsOptions } from "../config/
|
|
6
|
+
import type { PlatformStaticsOptions } from "../config/PlatformStaticsSettings.js";
|
|
7
7
|
import { CreateServerReturn } from "../utils/createServer.js";
|
|
8
8
|
import { PlatformApplication } from "./PlatformApplication.js";
|
|
9
9
|
export declare abstract class PlatformAdapter<App = TsED.Application> {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare function setHttpPort(settings: {
|
|
2
|
+
address: string;
|
|
3
|
+
port: number;
|
|
4
|
+
}): void;
|
|
5
|
+
export declare function setHttpsPort(settings: {
|
|
6
|
+
address: string;
|
|
7
|
+
port: number;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function getHttpsPort(): {
|
|
10
|
+
protocol: string;
|
|
11
|
+
address: string;
|
|
12
|
+
port: number;
|
|
13
|
+
toString(): string;
|
|
14
|
+
};
|
|
15
|
+
export declare function getHttpPort(): {
|
|
16
|
+
protocol: string;
|
|
17
|
+
address: string;
|
|
18
|
+
port: number;
|
|
19
|
+
toString(): string;
|
|
20
|
+
};
|
|
21
|
+
export declare function getBestHost(): {
|
|
22
|
+
protocol: string;
|
|
23
|
+
address: string;
|
|
24
|
+
port: number;
|
|
25
|
+
toString(): string;
|
|
26
|
+
} | {
|
|
27
|
+
toString(): string;
|
|
28
|
+
};
|
|
29
|
+
declare global {
|
|
30
|
+
namespace TsED {
|
|
31
|
+
interface Configuration {
|
|
32
|
+
readonly getBestHost: typeof getBestHost;
|
|
33
|
+
readonly getHttpPort: typeof getHttpPort;
|
|
34
|
+
readonly getHttpsPort: typeof getHttpsPort;
|
|
35
|
+
readonly setHttpsPort: typeof setHttpsPort;
|
|
36
|
+
readonly setHttpPort: typeof setHttpPort;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlatformStaticsOptions, PlatformStaticsSettings } from "../config/
|
|
1
|
+
import type { PlatformStaticsOptions, PlatformStaticsSettings } from "../config/PlatformStaticsSettings.js";
|
|
2
2
|
export declare function getStaticsOptions(statics?: PlatformStaticsSettings): {
|
|
3
3
|
path: string;
|
|
4
4
|
options: PlatformStaticsOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ProviderOpts } from "@tsed/di";
|
|
2
2
|
import { type PlatformContextHandler, PlatformLayer } from "@tsed/platform-router";
|
|
3
|
-
import { PlatformAdapter, PlatformContext, type
|
|
3
|
+
import { PlatformAdapter, PlatformContext, type PlatformStaticsOptions } from "../common/index.js";
|
|
4
4
|
export declare class FakeAdapter extends PlatformAdapter<any> {
|
|
5
5
|
readonly NAME: string;
|
|
6
6
|
providers: ProviderOpts[];
|
|
@@ -20,7 +20,7 @@ export declare class FakeAdapter extends PlatformAdapter<any> {
|
|
|
20
20
|
app: any;
|
|
21
21
|
callback(): any;
|
|
22
22
|
};
|
|
23
|
-
multipart(options:
|
|
23
|
+
multipart(options: TsED.MultipartFileOptions): TsED.MultipartFileInstance;
|
|
24
24
|
statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
25
25
|
bodyParser(type: string): any;
|
|
26
26
|
mapLayers(layers: PlatformLayer[]): void;
|
|
@@ -11,16 +11,16 @@ export declare class PlatformTest extends DITest {
|
|
|
11
11
|
/**
|
|
12
12
|
* Create a new injector with the right default services
|
|
13
13
|
*/
|
|
14
|
-
static createInjector(settings?:
|
|
14
|
+
static createInjector(settings?: Partial<TsED.Configuration>): InjectorService;
|
|
15
15
|
/**
|
|
16
16
|
* Load the server silently without listening port and configure it on test profile.
|
|
17
|
-
*
|
|
18
|
-
* @param mod
|
|
19
|
-
* @param listen
|
|
20
|
-
* @param settings
|
|
17
|
+
*
|
|
21
18
|
* @returns {Promise<void>}
|
|
22
19
|
*/
|
|
23
|
-
static bootstrap(
|
|
20
|
+
static bootstrap(settings?: Partial<PlatformBuilderSettings & {
|
|
21
|
+
listen: boolean;
|
|
22
|
+
}>): () => Promise<void>;
|
|
23
|
+
static bootstrap(mod: any, settings?: Partial<PlatformBuilderSettings & {
|
|
24
24
|
listen: boolean;
|
|
25
25
|
}>): () => Promise<void>;
|
|
26
26
|
/**
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/platform-http",
|
|
3
3
|
"description": "A TypeScript Framework on top of Express",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.16.0-rc.
|
|
5
|
+
"version": "8.16.0-rc.3",
|
|
6
6
|
"source": "./src/common/index.ts",
|
|
7
7
|
"main": "./lib/esm/common/index.js",
|
|
8
8
|
"module": "./lib/esm/common/index.js",
|
|
@@ -70,37 +70,38 @@
|
|
|
70
70
|
}
|
|
71
71
|
],
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@tsed/core": "8.16.0-rc.
|
|
74
|
-
"@tsed/di": "8.16.0-rc.
|
|
75
|
-
"@tsed/exceptions": "8.16.0-rc.
|
|
76
|
-
"@tsed/hooks": "8.16.0-rc.
|
|
77
|
-
"@tsed/json-mapper": "8.16.0-rc.
|
|
78
|
-
"@tsed/logger": "^8.0.0
|
|
79
|
-
"@tsed/logger-std": "^8.0.0
|
|
80
|
-
"@tsed/platform-
|
|
81
|
-
"@tsed/platform-
|
|
82
|
-
"@tsed/platform-
|
|
83
|
-
"@tsed/platform-
|
|
84
|
-
"@tsed/platform-
|
|
85
|
-
"@tsed/platform-
|
|
86
|
-
"@tsed/platform-
|
|
87
|
-
"@tsed/
|
|
73
|
+
"@tsed/core": "8.16.0-rc.3",
|
|
74
|
+
"@tsed/di": "8.16.0-rc.3",
|
|
75
|
+
"@tsed/exceptions": "8.16.0-rc.3",
|
|
76
|
+
"@tsed/hooks": "8.16.0-rc.3",
|
|
77
|
+
"@tsed/json-mapper": "8.16.0-rc.3",
|
|
78
|
+
"@tsed/logger": "^8.0.0",
|
|
79
|
+
"@tsed/logger-std": "^8.0.0",
|
|
80
|
+
"@tsed/platform-accept-mimes": "8.16.0-rc.3",
|
|
81
|
+
"@tsed/platform-exceptions": "8.16.0-rc.3",
|
|
82
|
+
"@tsed/platform-middlewares": "8.16.0-rc.3",
|
|
83
|
+
"@tsed/platform-multer": "8.16.0-rc.3",
|
|
84
|
+
"@tsed/platform-params": "8.16.0-rc.3",
|
|
85
|
+
"@tsed/platform-response-filter": "8.16.0-rc.3",
|
|
86
|
+
"@tsed/platform-router": "8.16.0-rc.3",
|
|
87
|
+
"@tsed/platform-views": "8.16.0-rc.3",
|
|
88
|
+
"@tsed/schema": "8.16.0-rc.3",
|
|
88
89
|
"@types/json-schema": "7.0.15",
|
|
89
90
|
"accepts": "^1.3.8",
|
|
90
91
|
"tslib": "2.7.0",
|
|
91
92
|
"uuid": "10.0.0"
|
|
92
93
|
},
|
|
93
94
|
"devDependencies": {
|
|
94
|
-
"@tsed/barrels": "8.16.0-rc.
|
|
95
|
-
"@tsed/engines": "8.16.0-rc.
|
|
96
|
-
"@tsed/typescript": "8.16.0-rc.
|
|
95
|
+
"@tsed/barrels": "8.16.0-rc.3",
|
|
96
|
+
"@tsed/engines": "8.16.0-rc.3",
|
|
97
|
+
"@tsed/typescript": "8.16.0-rc.3",
|
|
97
98
|
"cross-env": "7.0.3",
|
|
98
99
|
"eslint": "9.12.0",
|
|
99
100
|
"typescript": "5.4.5",
|
|
100
101
|
"vitest": "3.2.4"
|
|
101
102
|
},
|
|
102
103
|
"peerDependencies": {
|
|
103
|
-
"@tsed/logger": ">=8.0.0
|
|
104
|
+
"@tsed/logger": ">=8.0.0"
|
|
104
105
|
},
|
|
105
106
|
"peerDependenciesMeta": {
|
|
106
107
|
"@tsed/logger": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { getHostInfoFromPort, isBoolean } from "@tsed/core";
|
|
3
|
-
import { DIConfiguration, Injectable, ProviderScope } from "@tsed/di";
|
|
4
|
-
import { JsonMapperSettings } from "@tsed/json-mapper";
|
|
5
|
-
const rootDir = process.cwd();
|
|
6
|
-
/**
|
|
7
|
-
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
8
|
-
*/
|
|
9
|
-
let PlatformConfiguration = class PlatformConfiguration extends DIConfiguration {
|
|
10
|
-
constructor() {
|
|
11
|
-
super({ rootDir });
|
|
12
|
-
}
|
|
13
|
-
get port() {
|
|
14
|
-
return this.httpPort;
|
|
15
|
-
}
|
|
16
|
-
set port(value) {
|
|
17
|
-
this.httpPort = value;
|
|
18
|
-
}
|
|
19
|
-
get httpsOptions() {
|
|
20
|
-
return this.getRaw("httpsOptions");
|
|
21
|
-
}
|
|
22
|
-
set httpsOptions(value) {
|
|
23
|
-
this.setRaw("httpsOptions", value);
|
|
24
|
-
}
|
|
25
|
-
get httpPort() {
|
|
26
|
-
return this.getRaw("httpPort");
|
|
27
|
-
}
|
|
28
|
-
set httpPort(value) {
|
|
29
|
-
this.setRaw("httpPort", value);
|
|
30
|
-
}
|
|
31
|
-
get httpsPort() {
|
|
32
|
-
return this.getRaw("httpsPort");
|
|
33
|
-
}
|
|
34
|
-
set httpsPort(value) {
|
|
35
|
-
this.setRaw("httpsPort", value);
|
|
36
|
-
}
|
|
37
|
-
get mount() {
|
|
38
|
-
return this.get("mount");
|
|
39
|
-
}
|
|
40
|
-
set mount(value) {
|
|
41
|
-
this.setRaw("mount", value);
|
|
42
|
-
}
|
|
43
|
-
get statics() {
|
|
44
|
-
return this.getRaw("statics") || this.getRaw("serveStatic") || {};
|
|
45
|
-
}
|
|
46
|
-
set statics(value) {
|
|
47
|
-
this.setRaw("statics", value);
|
|
48
|
-
}
|
|
49
|
-
get acceptMimes() {
|
|
50
|
-
return this.getRaw("acceptMimes");
|
|
51
|
-
}
|
|
52
|
-
set acceptMimes(value) {
|
|
53
|
-
this.setRaw("acceptMimes", value || []);
|
|
54
|
-
}
|
|
55
|
-
get jsonMapper() {
|
|
56
|
-
return {
|
|
57
|
-
...JsonMapperSettings
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
set jsonMapper(options) {
|
|
61
|
-
JsonMapperSettings.strictGroups = Boolean(options.strictGroups);
|
|
62
|
-
JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
|
|
63
|
-
JsonMapperSettings.additionalProperties = Boolean(isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
|
|
64
|
-
}
|
|
65
|
-
get additionalProperties() {
|
|
66
|
-
return this.get("converter.additionalProperties") === "accept";
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
* @returns {string|number}
|
|
71
|
-
*/
|
|
72
|
-
getHttpPort() {
|
|
73
|
-
return getHostInfoFromPort("http", this.getRaw("httpPort"));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @param settings
|
|
78
|
-
*/
|
|
79
|
-
setHttpPort(settings) {
|
|
80
|
-
this.setRaw("httpPort", `${settings.address}:${settings.port}`);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @returns {string|number}
|
|
85
|
-
*/
|
|
86
|
-
getHttpsPort() {
|
|
87
|
-
return getHostInfoFromPort("https", this.getRaw("httpsPort"));
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param settings
|
|
92
|
-
*/
|
|
93
|
-
setHttpsPort(settings) {
|
|
94
|
-
this.setRaw("httpsPort", `${settings.address}:${settings.port}`);
|
|
95
|
-
}
|
|
96
|
-
getBestHost() {
|
|
97
|
-
const { httpsPort, httpPort } = this;
|
|
98
|
-
if (httpsPort) {
|
|
99
|
-
return this.getHttpsPort();
|
|
100
|
-
}
|
|
101
|
-
if (httpPort) {
|
|
102
|
-
return this.getHttpPort();
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
toString() {
|
|
106
|
-
return "/";
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
PlatformConfiguration = __decorate([
|
|
112
|
-
Injectable({
|
|
113
|
-
scope: ProviderScope.SINGLETON,
|
|
114
|
-
global: true
|
|
115
|
-
}),
|
|
116
|
-
__metadata("design:paramtypes", [])
|
|
117
|
-
], PlatformConfiguration);
|
|
118
|
-
export { PlatformConfiguration };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Env, Store } from "@tsed/core";
|
|
2
|
-
import { mergeMount, ProviderScope, ProviderType } from "@tsed/di";
|
|
3
|
-
export function getConfiguration(configuration = {}, module = null) {
|
|
4
|
-
if (configuration.$$resolved) {
|
|
5
|
-
return configuration;
|
|
6
|
-
}
|
|
7
|
-
const store = module ? Store.from(module).get("configuration") || {} : {};
|
|
8
|
-
const env = configuration.env || store.env || process.env.NODE_ENV || Env.DEV;
|
|
9
|
-
return {
|
|
10
|
-
$$resolved: true,
|
|
11
|
-
env,
|
|
12
|
-
httpPort: 8080,
|
|
13
|
-
httpsPort: false,
|
|
14
|
-
...store,
|
|
15
|
-
...configuration,
|
|
16
|
-
scopes: {
|
|
17
|
-
[ProviderType.CONTROLLER]: ProviderScope.SINGLETON,
|
|
18
|
-
...store.scopes,
|
|
19
|
-
...configuration.scopes
|
|
20
|
-
},
|
|
21
|
-
mount: mergeMount(store.mount, configuration.mount),
|
|
22
|
-
logger: {
|
|
23
|
-
debug: false,
|
|
24
|
-
level: env === Env.TEST ? "off" : "info",
|
|
25
|
-
logRequest: true,
|
|
26
|
-
...store.logger,
|
|
27
|
-
...configuration.logger,
|
|
28
|
-
jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { JsonMapperGlobalOptions } from "@tsed/json-mapper";
|
|
2
|
-
export interface PlatformJsonMapperSettings extends JsonMapperGlobalOptions {
|
|
3
|
-
}
|
|
4
|
-
declare global {
|
|
5
|
-
namespace TsED {
|
|
6
|
-
interface Configuration extends Record<string, any> {
|
|
7
|
-
jsonMapper?: PlatformJsonMapperSettings;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PlatformMulter as M1, PlatformMulterField as M4, PlatformMulterFile as M3, PlatformMulterSettings as M2 } from "@tsed/platform-multer";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Since v8.5. Use PlatformMulter from @tsed/platform-multer instead.
|
|
4
|
-
*/
|
|
5
|
-
export type PlatformMulter = M1;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Since v8.5. Use PlatformMulterSettings from @tsed/platform-multer instead.
|
|
8
|
-
*/
|
|
9
|
-
export type PlatformMulterSettings = M2;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Since v8.5. Use PlatformMulterFile from @tsed/platform-multer instead.
|
|
12
|
-
*/
|
|
13
|
-
export type PlatformMulterFile = M3;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Since v8.5. Use PlatformMulterField from @tsed/platform-multer instead.
|
|
16
|
-
*/
|
|
17
|
-
export type PlatformMulterField = M4;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import Https from "node:https";
|
|
3
|
-
import { getHostInfoFromPort } from "@tsed/core";
|
|
4
|
-
import { DIConfiguration, TokenProvider } from "@tsed/di";
|
|
5
|
-
import { PlatformJsonMapperSettings } from "../interfaces/PlatformJsonMapperSettings.js";
|
|
6
|
-
/**
|
|
7
|
-
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PlatformConfiguration extends DIConfiguration {
|
|
10
|
-
constructor();
|
|
11
|
-
get port(): string | number | false;
|
|
12
|
-
set port(value: string | number | false);
|
|
13
|
-
get httpsOptions(): Https.ServerOptions;
|
|
14
|
-
set httpsOptions(value: Https.ServerOptions);
|
|
15
|
-
get httpPort(): string | number | false;
|
|
16
|
-
set httpPort(value: string | number | false);
|
|
17
|
-
get httpsPort(): string | number | false;
|
|
18
|
-
set httpsPort(value: string | number | false);
|
|
19
|
-
get mount(): Record<string, TokenProvider[]>;
|
|
20
|
-
set mount(value: Record<string, TokenProvider[]>);
|
|
21
|
-
get statics(): Record<string, (any | string)[]>;
|
|
22
|
-
set statics(value: Record<string, (any | string)[]>);
|
|
23
|
-
get acceptMimes(): string[];
|
|
24
|
-
set acceptMimes(value: string[]);
|
|
25
|
-
get jsonMapper(): Partial<PlatformJsonMapperSettings>;
|
|
26
|
-
set jsonMapper(options: Partial<PlatformJsonMapperSettings>);
|
|
27
|
-
get additionalProperties(): boolean;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @returns {string|number}
|
|
31
|
-
*/
|
|
32
|
-
getHttpPort(): ReturnType<typeof getHostInfoFromPort>;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param settings
|
|
36
|
-
*/
|
|
37
|
-
setHttpPort(settings: {
|
|
38
|
-
address: string;
|
|
39
|
-
port: number;
|
|
40
|
-
}): void;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @returns {string|number}
|
|
44
|
-
*/
|
|
45
|
-
getHttpsPort(): {
|
|
46
|
-
protocol: string;
|
|
47
|
-
address: string;
|
|
48
|
-
port: number;
|
|
49
|
-
toString(): string;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param settings
|
|
54
|
-
*/
|
|
55
|
-
setHttpsPort(settings: {
|
|
56
|
-
address: string;
|
|
57
|
-
port: number;
|
|
58
|
-
}): void;
|
|
59
|
-
getBestHost(): {
|
|
60
|
-
protocol: string;
|
|
61
|
-
address: string;
|
|
62
|
-
port: number;
|
|
63
|
-
toString(): string;
|
|
64
|
-
} | {
|
|
65
|
-
toString(): string;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
declare global {
|
|
69
|
-
namespace TsED {
|
|
70
|
-
interface Context {
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Here to allow extension on DIConfiguration base service
|
|
74
|
-
*/
|
|
75
|
-
interface DIConfiguration extends PlatformConfiguration {
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
/package/lib/esm/common/config/{interfaces/PlatformStaticsSettings.js → PlatformStaticsSettings.js}
RENAMED
|
File without changes
|