@tsed/common 7.0.0-rc.3 → 7.0.0-rc.4
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/coverage.json +3 -3
- package/lib/cjs/config/interfaces/{ConverterSettings.js → PlatformJsonMapperSettings.js} +1 -1
- package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js.map +1 -0
- package/lib/cjs/config/services/PlatformConfiguration.js +8 -4
- package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js +2 -0
- package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js.map +1 -0
- package/lib/esm/config/services/PlatformConfiguration.js +9 -5
- package/lib/esm/config/services/PlatformConfiguration.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/types/config/interfaces/PlatformJsonMapperSettings.d.ts +10 -0
- package/lib/types/config/services/PlatformConfiguration.d.ts +3 -3
- package/lib/types/index.d.ts +1 -1
- package/package.json +18 -19
- package/readme.md +1 -1
- package/lib/cjs/config/interfaces/ConverterSettings.js.map +0 -1
- package/lib/esm/config/interfaces/ConverterSettings.js +0 -2
- package/lib/esm/config/interfaces/ConverterSettings.js.map +0 -1
- package/lib/types/config/interfaces/ConverterSettings.d.ts +0 -6
package/coverage.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformJsonMapperSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/PlatformJsonMapperSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface PlatformJsonMapperSettings {\n /**\n * JsonMapper additional property policy. (see [JsonMapper](/docs/json-mapper.md))\n */\n additionalProperties?: boolean;\n /**\n * Disable the unsecure constructor injection when the deserialize function is used (by default: false)\n */\n disableUnsecureConstructor?: boolean;\n}\n"]}
|
|
@@ -4,6 +4,7 @@ exports.PlatformConfiguration = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@tsed/core");
|
|
6
6
|
const di_1 = require("@tsed/di");
|
|
7
|
+
const json_mapper_1 = require("@tsed/json-mapper");
|
|
7
8
|
const rootDir = process.cwd();
|
|
8
9
|
/**
|
|
9
10
|
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
@@ -54,11 +55,14 @@ let PlatformConfiguration = class PlatformConfiguration extends di_1.DIConfigura
|
|
|
54
55
|
set acceptMimes(value) {
|
|
55
56
|
this.setRaw("acceptMimes", value || []);
|
|
56
57
|
}
|
|
57
|
-
get
|
|
58
|
-
return
|
|
58
|
+
get jsonMapper() {
|
|
59
|
+
return {
|
|
60
|
+
...json_mapper_1.JsonMapperSettings
|
|
61
|
+
};
|
|
59
62
|
}
|
|
60
|
-
set
|
|
61
|
-
|
|
63
|
+
set jsonMapper(options) {
|
|
64
|
+
json_mapper_1.JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
|
|
65
|
+
json_mapper_1.JsonMapperSettings.additionalProperties = Boolean((0, core_1.isBoolean)(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
|
|
62
66
|
}
|
|
63
67
|
get additionalProperties() {
|
|
64
68
|
return this.get("converter.additionalProperties") === "accept";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";;;;AAAA,qCAA0D;AAC1D,iCAAmF;AACnF,mDAAqD;AAIrD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE9B;;GAEG;AAKH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,oBAAe;IACxD;QAC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;QACT,MAAM,EAAC,SAAS,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;QAEnC,IAAI,SAAS,EAAE;YACb,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B;QAED,IAAI,QAAQ,EAAE;YACZ,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;SAC3B;QAED,OAAO;YACL,QAAQ;gBACN,OAAO,GAAG,CAAC;YACb,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA/HY,qBAAqB;IAJjC,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CA+HjC;AA/HY,sDAAqB","sourcesContent":["import {getHostInfoFromPort, isBoolean} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope, TokenProvider} from \"@tsed/di\";\nimport {JsonMapperSettings} from \"@tsed/json-mapper\";\nimport Https from \"https\";\nimport {PlatformJsonMapperSettings} from \"../interfaces/PlatformJsonMapperSettings\";\n\nconst rootDir = process.cwd();\n\n/**\n * `PlatformConfiguration` contains all information about your Server configuration.\n */\n@Injectable({\n scope: ProviderScope.SINGLETON,\n global: true\n})\nexport class PlatformConfiguration extends DIConfiguration {\n constructor() {\n super({rootDir});\n }\n\n get port(): string | number | false {\n return this.httpPort;\n }\n\n set port(value: string | number | false) {\n this.httpPort = value;\n }\n\n get httpsOptions(): Https.ServerOptions {\n return this.getRaw(\"httpsOptions\");\n }\n\n set httpsOptions(value: Https.ServerOptions) {\n this.setRaw(\"httpsOptions\", value);\n }\n\n get httpPort(): string | number | false {\n return this.getRaw(\"httpPort\");\n }\n\n set httpPort(value: string | number | false) {\n this.setRaw(\"httpPort\", value);\n }\n\n get httpsPort(): string | number | false {\n return this.getRaw(\"httpsPort\");\n }\n\n set httpsPort(value: string | number | false) {\n this.setRaw(\"httpsPort\", value);\n }\n\n get mount(): Record<string, TokenProvider[]> {\n return this.get(\"mount\");\n }\n\n set mount(value: Record<string, TokenProvider[]>) {\n this.setRaw(\"mount\", value);\n }\n\n get statics(): Record<string, (any | string)[]> {\n return this.getRaw(\"statics\") || this.getRaw(\"serveStatic\") || {};\n }\n\n set statics(value: Record<string, (any | string)[]>) {\n this.setRaw(\"statics\", value);\n }\n\n get acceptMimes(): string[] {\n return this.getRaw(\"acceptMimes\");\n }\n\n set acceptMimes(value: string[]) {\n this.setRaw(\"acceptMimes\", value || []);\n }\n\n get jsonMapper(): Partial<PlatformJsonMapperSettings> {\n return {\n ...JsonMapperSettings\n };\n }\n\n set jsonMapper(options: Partial<PlatformJsonMapperSettings>) {\n JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);\n JsonMapperSettings.additionalProperties = Boolean(\n isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === \"accept\"\n );\n }\n\n get additionalProperties() {\n return this.get(\"converter.additionalProperties\") === \"accept\";\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpPort(): ReturnType<typeof getHostInfoFromPort> {\n return getHostInfoFromPort(\"http\", this.getRaw(\"httpPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpPort\", `${settings.address}:${settings.port}`);\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpsPort() {\n return getHostInfoFromPort(\"https\", this.getRaw(\"httpsPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpsPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpsPort\", `${settings.address}:${settings.port}`);\n }\n\n getBestHost() {\n const {httpsPort, httpPort} = this;\n\n if (httpsPort) {\n return this.getHttpsPort();\n }\n\n if (httpPort) {\n return this.getHttpPort();\n }\n\n return {\n toString() {\n return \"/\";\n }\n };\n }\n}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
tslib_1.__exportStar(require("./exports"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./builder/PlatformBuilder"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./config/interfaces/
|
|
9
|
+
tslib_1.__exportStar(require("./config/interfaces/PlatformJsonMapperSettings"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./config/interfaces/PlatformLoggerSettings"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./config/interfaces/PlatformMulterSettings"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./config/interfaces/PlatformStaticsSettings"), exports);
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAA0B;AAC1B,oEAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAA0B;AAC1B,oEAA0C;AAC1C,yFAA+D;AAC/D,qFAA2D;AAC3D,qFAA2D;AAC3D,sFAA4D;AAC5D,kFAAwD;AACxD,oEAA0C;AAC1C,6EAAmD;AACnD,4EAAkD;AAClD,4EAAkD;AAClD,oEAA0C;AAC1C,mEAAyC;AACzC,sEAA4C;AAC5C,uEAA6C;AAC7C,uEAA6C;AAC7C,oEAA0C;AAC1C,mEAAyC;AACzC,wEAA8C;AAC9C,iEAAuC;AACvC,mEAAyC;AACzC,uEAA6C;AAC7C,kEAAwC;AACxC,oEAA0C;AAC1C,wEAA8C;AAC9C,mEAAyC;AACzC,qEAA2C;AAC3C,+DAAqC;AACrC,iEAAuC;AACvC,kEAAwC;AACxC,oEAA0C;AAC1C,4EAAkD;AAClD,2EAAiD;AACjD,6DAAmC;AACnC,sFAA4D;AAC5D,iFAAuD;AACvD,iEAAuC;AACvC,8DAAoC;AACpC,qEAA2C;AAC3C,yEAA+C;AAC/C,qEAA2C;AAC3C,8EAAoD;AACpD,qEAA2C;AAC3C,sEAA4C;AAC5C,kEAAwC;AACxC,gEAAsC;AACtC,mEAAyC;AACzC,oEAA0C;AAC1C,iEAAuC;AACvC,gEAAsC;AACtC,oEAA0C;AAC1C,+DAAqC;AACrC,sEAA4C;AAC5C,8DAAoC;AACpC,qEAA2C","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./exports\";\nexport * from \"./builder/PlatformBuilder\";\nexport * from \"./config/interfaces/PlatformJsonMapperSettings\";\nexport * from \"./config/interfaces/PlatformLoggerSettings\";\nexport * from \"./config/interfaces/PlatformMulterSettings\";\nexport * from \"./config/interfaces/PlatformStaticsSettings\";\nexport * from \"./config/services/PlatformConfiguration\";\nexport * from \"./constants/routerOptions\";\nexport * from \"./decorators/multer/multerFileSize\";\nexport * from \"./decorators/multer/multerOptions\";\nexport * from \"./decorators/multer/multipartFile\";\nexport * from \"./decorators/params/error\";\nexport * from \"./decorators/params/next\";\nexport * from \"./decorators/params/request\";\nexport * from \"./decorators/params/response\";\nexport * from \"./domain/AnyToPromiseWithCtx\";\nexport * from \"./domain/EndpointMetadata\";\nexport * from \"./domain/PlatformContext\";\nexport * from \"./domain/PlatformRouteDetails\";\nexport * from \"./interfaces/AfterInit\";\nexport * from \"./interfaces/AfterListen\";\nexport * from \"./interfaces/AfterRoutesInit\";\nexport * from \"./interfaces/BeforeInit\";\nexport * from \"./interfaces/BeforeListen\";\nexport * from \"./interfaces/BeforeRoutesInit\";\nexport * from \"./interfaces/HandlerType\";\nexport * from \"./interfaces/IncomingEvent\";\nexport * from \"./interfaces/OnReady\";\nexport * from \"./interfaces/OnRequest\";\nexport * from \"./interfaces/OnResponse\";\nexport * from \"./interfaces/OnRoutesInit\";\nexport * from \"./interfaces/PlatformRouteOptions\";\nexport * from \"./interfaces/ResponseErrorObject\";\nexport * from \"./interfaces/Route\";\nexport * from \"./middlewares/PlatformAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformMulterMiddleware\";\nexport * from \"./services/FakeAdapter\";\nexport * from \"./services/Platform\";\nexport * from \"./services/PlatformAdapter\";\nexport * from \"./services/PlatformApplication\";\nexport * from \"./services/PlatformHandler\";\nexport * from \"./services/PlatformMiddlewaresChain\";\nexport * from \"./services/PlatformRequest\";\nexport * from \"./services/PlatformResponse\";\nexport * from \"./services/PlatformTest\";\nexport * from \"./utils/createContext\";\nexport * from \"./utils/createHttpServer\";\nexport * from \"./utils/createHttpsServer\";\nexport * from \"./utils/createInjector\";\nexport * from \"./utils/ensureContext\";\nexport * from \"./utils/getStaticsOptions\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformJsonMapperSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/PlatformJsonMapperSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface PlatformJsonMapperSettings {\n /**\n * JsonMapper additional property policy. (see [JsonMapper](/docs/json-mapper.md))\n */\n additionalProperties?: boolean;\n /**\n * Disable the unsecure constructor injection when the deserialize function is used (by default: false)\n */\n disableUnsecureConstructor?: boolean;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { getHostInfoFromPort } from "@tsed/core";
|
|
2
|
+
import { getHostInfoFromPort, isBoolean } from "@tsed/core";
|
|
3
3
|
import { DIConfiguration, Injectable, ProviderScope } from "@tsed/di";
|
|
4
|
+
import { JsonMapperSettings } from "@tsed/json-mapper";
|
|
4
5
|
const rootDir = process.cwd();
|
|
5
6
|
/**
|
|
6
7
|
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
@@ -51,11 +52,14 @@ let PlatformConfiguration = class PlatformConfiguration extends DIConfiguration
|
|
|
51
52
|
set acceptMimes(value) {
|
|
52
53
|
this.setRaw("acceptMimes", value || []);
|
|
53
54
|
}
|
|
54
|
-
get
|
|
55
|
-
return
|
|
55
|
+
get jsonMapper() {
|
|
56
|
+
return {
|
|
57
|
+
...JsonMapperSettings
|
|
58
|
+
};
|
|
56
59
|
}
|
|
57
|
-
set
|
|
58
|
-
|
|
60
|
+
set jsonMapper(options) {
|
|
61
|
+
JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
|
|
62
|
+
JsonMapperSettings.additionalProperties = Boolean(isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
|
|
59
63
|
}
|
|
60
64
|
get additionalProperties() {
|
|
61
65
|
return this.get("converter.additionalProperties") === "accept";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,mBAAmB,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAE,UAAU,EAAE,aAAa,EAAgB,MAAM,UAAU,CAAC;AACnF,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAIrD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE9B;;GAEG;AAKH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,eAAe;IACxD;QACE,KAAK,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,CAAC,KAA8B;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,M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ACF,CAAC;IACJ,CAAC;CACF,CAAA;AA/HY,qBAAqB;IAJjC,UAAU,CAAC;QACV,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CA+HjC;SA/HY,qBAAqB","sourcesContent":["import {getHostInfoFromPort, isBoolean} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope, TokenProvider} from \"@tsed/di\";\nimport {JsonMapperSettings} from \"@tsed/json-mapper\";\nimport Https from \"https\";\nimport {PlatformJsonMapperSettings} from \"../interfaces/PlatformJsonMapperSettings\";\n\nconst rootDir = process.cwd();\n\n/**\n * `PlatformConfiguration` contains all information about your Server configuration.\n */\n@Injectable({\n scope: ProviderScope.SINGLETON,\n global: true\n})\nexport class PlatformConfiguration extends DIConfiguration {\n constructor() {\n super({rootDir});\n }\n\n get port(): string | number | false {\n return this.httpPort;\n }\n\n set port(value: string | number | false) {\n this.httpPort = value;\n }\n\n get httpsOptions(): Https.ServerOptions {\n return this.getRaw(\"httpsOptions\");\n }\n\n set httpsOptions(value: Https.ServerOptions) {\n this.setRaw(\"httpsOptions\", value);\n }\n\n get httpPort(): string | number | false {\n return this.getRaw(\"httpPort\");\n }\n\n set httpPort(value: string | number | false) {\n this.setRaw(\"httpPort\", value);\n }\n\n get httpsPort(): string | number | false {\n return this.getRaw(\"httpsPort\");\n }\n\n set httpsPort(value: string | number | false) {\n this.setRaw(\"httpsPort\", value);\n }\n\n get mount(): Record<string, TokenProvider[]> {\n return this.get(\"mount\");\n }\n\n set mount(value: Record<string, TokenProvider[]>) {\n this.setRaw(\"mount\", value);\n }\n\n get statics(): Record<string, (any | string)[]> {\n return this.getRaw(\"statics\") || this.getRaw(\"serveStatic\") || {};\n }\n\n set statics(value: Record<string, (any | string)[]>) {\n this.setRaw(\"statics\", value);\n }\n\n get acceptMimes(): string[] {\n return this.getRaw(\"acceptMimes\");\n }\n\n set acceptMimes(value: string[]) {\n this.setRaw(\"acceptMimes\", value || []);\n }\n\n get jsonMapper(): Partial<PlatformJsonMapperSettings> {\n return {\n ...JsonMapperSettings\n };\n }\n\n set jsonMapper(options: Partial<PlatformJsonMapperSettings>) {\n JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);\n JsonMapperSettings.additionalProperties = Boolean(\n isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === \"accept\"\n );\n }\n\n get additionalProperties() {\n return this.get(\"converter.additionalProperties\") === \"accept\";\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpPort(): ReturnType<typeof getHostInfoFromPort> {\n return getHostInfoFromPort(\"http\", this.getRaw(\"httpPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpPort\", `${settings.address}:${settings.port}`);\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpsPort() {\n return getHostInfoFromPort(\"https\", this.getRaw(\"httpsPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpsPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpsPort\", `${settings.address}:${settings.port}`);\n }\n\n getBestHost() {\n const {httpsPort, httpPort} = this;\n\n if (httpsPort) {\n return this.getHttpsPort();\n }\n\n if (httpPort) {\n return this.getHttpPort();\n }\n\n return {\n toString() {\n return \"/\";\n }\n };\n }\n}\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from "./exports.js";
|
|
5
5
|
export * from "./builder/PlatformBuilder.js";
|
|
6
|
-
export * from "./config/interfaces/
|
|
6
|
+
export * from "./config/interfaces/PlatformJsonMapperSettings.js";
|
|
7
7
|
export * from "./config/interfaces/PlatformLoggerSettings.js";
|
|
8
8
|
export * from "./config/interfaces/PlatformMulterSettings.js";
|
|
9
9
|
export * from "./config/interfaces/PlatformStaticsSettings.js";
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./exports\";\nexport * from \"./builder/PlatformBuilder\";\nexport * from \"./config/interfaces/PlatformJsonMapperSettings\";\nexport * from \"./config/interfaces/PlatformLoggerSettings\";\nexport * from \"./config/interfaces/PlatformMulterSettings\";\nexport * from \"./config/interfaces/PlatformStaticsSettings\";\nexport * from \"./config/services/PlatformConfiguration\";\nexport * from \"./constants/routerOptions\";\nexport * from \"./decorators/multer/multerFileSize\";\nexport * from \"./decorators/multer/multerOptions\";\nexport * from \"./decorators/multer/multipartFile\";\nexport * from \"./decorators/params/error\";\nexport * from \"./decorators/params/next\";\nexport * from \"./decorators/params/request\";\nexport * from \"./decorators/params/response\";\nexport * from \"./domain/AnyToPromiseWithCtx\";\nexport * from \"./domain/EndpointMetadata\";\nexport * from \"./domain/PlatformContext\";\nexport * from \"./domain/PlatformRouteDetails\";\nexport * from \"./interfaces/AfterInit\";\nexport * from \"./interfaces/AfterListen\";\nexport * from \"./interfaces/AfterRoutesInit\";\nexport * from \"./interfaces/BeforeInit\";\nexport * from \"./interfaces/BeforeListen\";\nexport * from \"./interfaces/BeforeRoutesInit\";\nexport * from \"./interfaces/HandlerType\";\nexport * from \"./interfaces/IncomingEvent\";\nexport * from \"./interfaces/OnReady\";\nexport * from \"./interfaces/OnRequest\";\nexport * from \"./interfaces/OnResponse\";\nexport * from \"./interfaces/OnRoutesInit\";\nexport * from \"./interfaces/PlatformRouteOptions\";\nexport * from \"./interfaces/ResponseErrorObject\";\nexport * from \"./interfaces/Route\";\nexport * from \"./middlewares/PlatformAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformMulterMiddleware\";\nexport * from \"./services/FakeAdapter\";\nexport * from \"./services/Platform\";\nexport * from \"./services/PlatformAdapter\";\nexport * from \"./services/PlatformApplication\";\nexport * from \"./services/PlatformHandler\";\nexport * from \"./services/PlatformMiddlewaresChain\";\nexport * from \"./services/PlatformRequest\";\nexport * from \"./services/PlatformResponse\";\nexport * from \"./services/PlatformTest\";\nexport * from \"./utils/createContext\";\nexport * from \"./utils/createHttpServer\";\nexport * from \"./utils/createHttpsServer\";\nexport * from \"./utils/createInjector\";\nexport * from \"./utils/ensureContext\";\nexport * from \"./utils/getStaticsOptions\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface PlatformJsonMapperSettings {
|
|
2
|
+
/**
|
|
3
|
+
* JsonMapper additional property policy. (see [JsonMapper](/docs/json-mapper.md))
|
|
4
|
+
*/
|
|
5
|
+
additionalProperties?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Disable the unsecure constructor injection when the deserialize function is used (by default: false)
|
|
8
|
+
*/
|
|
9
|
+
disableUnsecureConstructor?: boolean;
|
|
10
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getHostInfoFromPort } from "@tsed/core";
|
|
3
3
|
import { DIConfiguration, TokenProvider } from "@tsed/di";
|
|
4
4
|
import Https from "https";
|
|
5
|
-
import {
|
|
5
|
+
import { PlatformJsonMapperSettings } from "../interfaces/PlatformJsonMapperSettings";
|
|
6
6
|
/**
|
|
7
7
|
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
8
8
|
*/
|
|
@@ -22,8 +22,8 @@ export declare class PlatformConfiguration extends DIConfiguration {
|
|
|
22
22
|
set statics(value: Record<string, (any | string)[]>);
|
|
23
23
|
get acceptMimes(): string[];
|
|
24
24
|
set acceptMimes(value: string[]);
|
|
25
|
-
get
|
|
26
|
-
set
|
|
25
|
+
get jsonMapper(): Partial<PlatformJsonMapperSettings>;
|
|
26
|
+
set jsonMapper(options: Partial<PlatformJsonMapperSettings>);
|
|
27
27
|
get additionalProperties(): boolean;
|
|
28
28
|
/**
|
|
29
29
|
*
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from "./exports";
|
|
5
5
|
export * from "./builder/PlatformBuilder";
|
|
6
|
-
export * from "./config/interfaces/
|
|
6
|
+
export * from "./config/interfaces/PlatformJsonMapperSettings";
|
|
7
7
|
export * from "./config/interfaces/PlatformLoggerSettings";
|
|
8
8
|
export * from "./config/interfaces/PlatformMulterSettings";
|
|
9
9
|
export * from "./config/interfaces/PlatformStaticsSettings";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/common",
|
|
3
|
-
"version": "7.0.0-rc.
|
|
3
|
+
"version": "7.0.0-rc.4",
|
|
4
4
|
"description": "A TypeScript Framework on top of Express",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -62,29 +62,28 @@
|
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@tsed/
|
|
66
|
-
"@tsed/
|
|
67
|
-
"@tsed/
|
|
68
|
-
"@tsed/
|
|
69
|
-
"@tsed/
|
|
70
|
-
"@tsed/logger": ">=6.2.
|
|
71
|
-
"@tsed/
|
|
72
|
-
"@tsed/
|
|
73
|
-
"@tsed/platform-
|
|
74
|
-
"@tsed/platform-
|
|
75
|
-
"@tsed/platform-
|
|
76
|
-
"@tsed/platform-
|
|
77
|
-
"@tsed/platform-
|
|
78
|
-
"@tsed/platform-
|
|
79
|
-
"@tsed/
|
|
80
|
-
"@tsed/schema": "7.0.0-rc.3",
|
|
65
|
+
"@tsed/core": "7.0.0-rc.4",
|
|
66
|
+
"@tsed/di": "7.0.0-rc.4",
|
|
67
|
+
"@tsed/exceptions": "7.0.0-rc.4",
|
|
68
|
+
"@tsed/json-mapper": "7.0.0-rc.4",
|
|
69
|
+
"@tsed/logger": ">=6.2.2",
|
|
70
|
+
"@tsed/logger-file": ">=6.2.2",
|
|
71
|
+
"@tsed/perf": "7.0.0-rc.4",
|
|
72
|
+
"@tsed/platform-exceptions": "7.0.0-rc.4",
|
|
73
|
+
"@tsed/platform-log-middleware": "7.0.0-rc.4",
|
|
74
|
+
"@tsed/platform-middlewares": "7.0.0-rc.4",
|
|
75
|
+
"@tsed/platform-params": "7.0.0-rc.4",
|
|
76
|
+
"@tsed/platform-response-filter": "7.0.0-rc.4",
|
|
77
|
+
"@tsed/platform-router": "7.0.0-rc.4",
|
|
78
|
+
"@tsed/platform-views": "7.0.0-rc.4",
|
|
79
|
+
"@tsed/schema": "7.0.0-rc.4",
|
|
81
80
|
"@types/json-schema": "7.0.11",
|
|
82
81
|
"tslib": "2.4.0",
|
|
83
82
|
"uuid": "8.3.2"
|
|
84
83
|
},
|
|
85
84
|
"peerDependencies": {
|
|
86
|
-
"@tsed/logger": ">=6.2.
|
|
87
|
-
"@tsed/logger-file": ">=6.2.
|
|
85
|
+
"@tsed/logger": ">=6.2.2",
|
|
86
|
+
"@tsed/logger-file": ">=6.2.2"
|
|
88
87
|
},
|
|
89
88
|
"peerDependenciesMeta": {
|
|
90
89
|
"@tsed/logger": {
|
package/readme.md
CHANGED
|
@@ -42,7 +42,7 @@ to make your code more readable and less error-prone.
|
|
|
42
42
|
- Define class as Controller,
|
|
43
43
|
- Define class as Service (IoC),
|
|
44
44
|
- Define class as Middleware and MiddlewareError,
|
|
45
|
-
- Define class as
|
|
45
|
+
- Define class as Json Mapper (POJ to Model and Model to POJ),
|
|
46
46
|
- Define root path for an entire controller and versioning your Rest API,
|
|
47
47
|
- Define as sub-route path for a method,
|
|
48
48
|
- Define routes on GET, POST, PUT, DELETE and HEAD verbs,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConverterSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/ConverterSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConverterSettings {\n /**\n * Converter additional property policy. (see [Converters](/docs/converters.md))\n */\n additionalProperties?: \"error\" | \"accept\" | \"ignore\";\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConverterSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/ConverterSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConverterSettings {\n /**\n * Converter additional property policy. (see [Converters](/docs/converters.md))\n */\n additionalProperties?: \"error\" | \"accept\" | \"ignore\";\n}\n"]}
|