@tsed/common 6.128.8 → 6.128.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "statements": 92.25,
3
- "branches": 77.85,
3
+ "branches": 77.65,
4
4
  "functions": 88.81,
5
5
  "lines": 92.24
6
6
  }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ConverterSettings.js.map
3
+ //# sourceMappingURL=PlatformJsonMapperSettings.js.map
@@ -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/converters.md))\n */\n additionalProperties?: \"error\" | \"accept\" | \"ignore\" | 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.
@@ -66,11 +67,26 @@ let PlatformConfiguration = class PlatformConfiguration extends di_1.DIConfigura
66
67
  set acceptMimes(value) {
67
68
  this.setRaw("acceptMimes", value || []);
68
69
  }
70
+ /**
71
+ * @deprecated
72
+ */
69
73
  get converter() {
70
- return this.get("converter") || {};
74
+ return this.jsonMapper;
71
75
  }
76
+ /**
77
+ * @deprecated
78
+ */
79
+ // istanbul ignore next
72
80
  set converter(options) {
73
- this.setRaw("converter", options);
81
+ this.jsonMapper = options;
82
+ }
83
+ get jsonMapper() {
84
+ return this.get("jsonMapper") || {};
85
+ }
86
+ set jsonMapper(options) {
87
+ this.setRaw("jsonMapper", options);
88
+ json_mapper_1.JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
89
+ json_mapper_1.JsonMapperSettings.additionalProperties = Boolean((0, core_1.isBoolean)(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
74
90
  }
75
91
  get exclude() {
76
92
  return this.get("exclude");
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";;;;AAAA,qCAAoD;AACpD,iCAAmF;AAInF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE9B;;GAEG;AAKH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,oBAAe;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,MAAM,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,YAAY,CAAC,KAA0B;QACzC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,QAAQ,CAAC,KAA8B;QACzC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAED,IA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AC,OAAiB;QAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAA,0BAAmB,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAyC;QACnD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACH,YAAY;QACV,OAAO,IAAA,0BAAmB,EAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,QAAyC;QACpD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,WAAW;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;AA5IY,qBAAqB;IAJjC,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CA4IjC;AA5IY,sDAAqB","sourcesContent":["import {Env, getHostInfoFromPort} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope, TokenProvider} from \"@tsed/di\";\nimport Https from \"https\";\nimport {ConverterSettings} from \"../interfaces/ConverterSettings\";\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 /**\n * @deprecated\n */\n get componentsScan(): string[] {\n return this.getRaw(\"componentsScan\");\n }\n\n /**\n * @deprecated\n */\n set componentsScan(value: string[]) {\n this.setRaw(\"componentsScan\", 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 converter(): Partial<ConverterSettings> {\n return this.get(\"converter\") || {};\n }\n\n set converter(options: Partial<ConverterSettings>) {\n this.setRaw(\"converter\", options);\n }\n\n get exclude() {\n return this.get(\"exclude\");\n }\n\n set exclude(exclude: string[]) {\n this.setRaw(\"exclude\", exclude);\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"]}
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;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,MAAM,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,YAAY,CAAC,KAA0B;QACzC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM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;QACpD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,WAAW;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;AAhKY,qBAAqB;IAJjC,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CAgKjC;AAhKY,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 /**\n * @deprecated\n */\n get componentsScan(): string[] {\n return this.getRaw(\"componentsScan\");\n }\n\n /**\n * @deprecated\n */\n set componentsScan(value: string[]) {\n this.setRaw(\"componentsScan\", 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 /**\n * @deprecated\n */\n get converter(): Partial<PlatformJsonMapperSettings> {\n return this.jsonMapper;\n }\n\n /**\n * @deprecated\n */\n // istanbul ignore next\n set converter(options: Partial<PlatformJsonMapperSettings>) {\n this.jsonMapper = options;\n }\n\n get jsonMapper(): Partial<PlatformJsonMapperSettings> {\n return this.get(\"jsonMapper\") || {};\n }\n\n set jsonMapper(options: Partial<PlatformJsonMapperSettings>) {\n this.setRaw(\"jsonMapper\", options);\n\n JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);\n JsonMapperSettings.additionalProperties = Boolean(\n isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === \"accept\"\n );\n }\n\n get exclude() {\n return this.get(\"exclude\");\n }\n\n set exclude(exclude: string[]) {\n this.setRaw(\"exclude\", exclude);\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
@@ -8,7 +8,7 @@ tslib_1.__exportStar(require("./PlatformModule"), exports);
8
8
  tslib_1.__exportStar(require("./exports"), exports);
9
9
  tslib_1.__exportStar(require("./builder/PlatformBuilder"), exports);
10
10
  tslib_1.__exportStar(require("./builder/PlatformControllerBuilder"), exports);
11
- tslib_1.__exportStar(require("./config/interfaces/ConverterSettings"), exports);
11
+ tslib_1.__exportStar(require("./config/interfaces/PlatformJsonMapperSettings"), exports);
12
12
  tslib_1.__exportStar(require("./config/interfaces/PlatformLoggerSettings"), exports);
13
13
  tslib_1.__exportStar(require("./config/interfaces/PlatformMulterSettings"), exports);
14
14
  tslib_1.__exportStar(require("./config/interfaces/PlatformStaticsSettings"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2DAAiC;AACjC,oDAA0B;AAC1B,oEAA0C;AAC1C,8EAAoD;AACpD,gFAAsD;AACtD,qFAA2D;AAC3D,qFAA2D;AAC3D,sFAA4D;AAC5D,kFAAwD;AACxD,oEAA0C;AAC1C,kEAAwC;AACxC,mEAAyC;AACzC,yEAA+C;AAC/C,6EAAmD;AACnD,4EAAkD;AAClD,4EAAkD;AAClD,2EAAiD;AACjD,oEAA0C;AAC1C,mEAAyC;AACzC,sEAA4C;AAC5C,uEAA6C;AAC7C,2EAAiD;AACjD,uEAA6C;AAC7C,sEAA4C;AAC5C,oEAA0C;AAC1C,mEAAyC;AACzC,mEAAyC;AACzC,wEAA8C;AAC9C,oEAA0C;AAC1C,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,8EAAoD;AACpD,oFAA0D;AAC1D,sFAA4D;AAC5D,iFAAuD;AACvD,+EAAqD;AACrD,iEAAuC;AACvC,8DAAoC;AACpC,qEAA2C;AAC3C,yEAA+C;AAC/C,qEAA2C;AAC3C,8EAAoD;AACpD,qEAA2C;AAC3C,sEAA4C;AAC5C,oEAA0C;AAC1C,kEAAwC;AACxC,gEAAsC;AACtC,wEAA8C;AAC9C,mEAAyC;AACzC,oEAA0C;AAC1C,iEAAuC;AACvC,oEAA0C;AAC1C,+DAAqC;AACrC,sEAA4C;AAC5C,8DAAoC;AACpC,qEAA2C;AAC3C,gEAAsC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./PlatformModule\";\nexport * from \"./exports\";\nexport * from \"./builder/PlatformBuilder\";\nexport * from \"./builder/PlatformControllerBuilder\";\nexport * from \"./config/interfaces/ConverterSettings\";\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/httpServer\";\nexport * from \"./decorators/httpsServer\";\nexport * from \"./decorators/method/endpointFn\";\nexport * from \"./decorators/multer/multerFileSize\";\nexport * from \"./decorators/multer/multerOptions\";\nexport * from \"./decorators/multer/multipartFile\";\nexport * from \"./decorators/params/endpointInfo\";\nexport * from \"./decorators/params/error\";\nexport * from \"./decorators/params/next\";\nexport * from \"./decorators/params/request\";\nexport * from \"./decorators/params/response\";\nexport * from \"./decorators/params/responseData\";\nexport * from \"./domain/AnyToPromiseWithCtx\";\nexport * from \"./domain/ControllerProvider\";\nexport * from \"./domain/EndpointMetadata\";\nexport * from \"./domain/HandlerMetadata\";\nexport * from \"./domain/PlatformContext\";\nexport * from \"./domain/PlatformRouteDetails\";\nexport * from \"./domain/PropertyMetadata\";\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/AcceptMimesMiddleware\";\nexport * from \"./middlewares/GlobalAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformMulterMiddleware\";\nexport * from \"./middlewares/bindEndpointMiddleware\";\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/PlatformRouter\";\nexport * from \"./services/PlatformTest\";\nexport * from \"./utils/createContext\";\nexport * from \"./utils/createHandlerMetadata\";\nexport * from \"./utils/createHttpServer\";\nexport * from \"./utils/createHttpsServer\";\nexport * from \"./utils/createInjector\";\nexport * from \"./utils/getStaticsOptions\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\nexport * from \"./utils/useCtxHandler\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2DAAiC;AACjC,oDAA0B;AAC1B,oEAA0C;AAC1C,8EAAoD;AACpD,yFAA+D;AAC/D,qFAA2D;AAC3D,qFAA2D;AAC3D,sFAA4D;AAC5D,kFAAwD;AACxD,oEAA0C;AAC1C,kEAAwC;AACxC,mEAAyC;AACzC,yEAA+C;AAC/C,6EAAmD;AACnD,4EAAkD;AAClD,4EAAkD;AAClD,2EAAiD;AACjD,oEAA0C;AAC1C,mEAAyC;AACzC,sEAA4C;AAC5C,uEAA6C;AAC7C,2EAAiD;AACjD,uEAA6C;AAC7C,sEAA4C;AAC5C,oEAA0C;AAC1C,mEAAyC;AACzC,mEAAyC;AACzC,wEAA8C;AAC9C,oEAA0C;AAC1C,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,8EAAoD;AACpD,oFAA0D;AAC1D,sFAA4D;AAC5D,iFAAuD;AACvD,+EAAqD;AACrD,iEAAuC;AACvC,8DAAoC;AACpC,qEAA2C;AAC3C,yEAA+C;AAC/C,qEAA2C;AAC3C,8EAAoD;AACpD,qEAA2C;AAC3C,sEAA4C;AAC5C,oEAA0C;AAC1C,kEAAwC;AACxC,gEAAsC;AACtC,wEAA8C;AAC9C,mEAAyC;AACzC,oEAA0C;AAC1C,iEAAuC;AACvC,oEAA0C;AAC1C,+DAAqC;AACrC,sEAA4C;AAC5C,8DAAoC;AACpC,qEAA2C;AAC3C,gEAAsC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./PlatformModule\";\nexport * from \"./exports\";\nexport * from \"./builder/PlatformBuilder\";\nexport * from \"./builder/PlatformControllerBuilder\";\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/httpServer\";\nexport * from \"./decorators/httpsServer\";\nexport * from \"./decorators/method/endpointFn\";\nexport * from \"./decorators/multer/multerFileSize\";\nexport * from \"./decorators/multer/multerOptions\";\nexport * from \"./decorators/multer/multipartFile\";\nexport * from \"./decorators/params/endpointInfo\";\nexport * from \"./decorators/params/error\";\nexport * from \"./decorators/params/next\";\nexport * from \"./decorators/params/request\";\nexport * from \"./decorators/params/response\";\nexport * from \"./decorators/params/responseData\";\nexport * from \"./domain/AnyToPromiseWithCtx\";\nexport * from \"./domain/ControllerProvider\";\nexport * from \"./domain/EndpointMetadata\";\nexport * from \"./domain/HandlerMetadata\";\nexport * from \"./domain/PlatformContext\";\nexport * from \"./domain/PlatformRouteDetails\";\nexport * from \"./domain/PropertyMetadata\";\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/AcceptMimesMiddleware\";\nexport * from \"./middlewares/GlobalAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformMulterMiddleware\";\nexport * from \"./middlewares/bindEndpointMiddleware\";\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/PlatformRouter\";\nexport * from \"./services/PlatformTest\";\nexport * from \"./utils/createContext\";\nexport * from \"./utils/createHandlerMetadata\";\nexport * from \"./utils/createHttpServer\";\nexport * from \"./utils/createHttpsServer\";\nexport * from \"./utils/createInjector\";\nexport * from \"./utils/getStaticsOptions\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\nexport * from \"./utils/useCtxHandler\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PlatformJsonMapperSettings.js.map
@@ -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/converters.md))\n */\n additionalProperties?: \"error\" | \"accept\" | \"ignore\" | 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.
@@ -63,11 +64,26 @@ let PlatformConfiguration = class PlatformConfiguration extends DIConfiguration
63
64
  set acceptMimes(value) {
64
65
  this.setRaw("acceptMimes", value || []);
65
66
  }
67
+ /**
68
+ * @deprecated
69
+ */
66
70
  get converter() {
67
- return this.get("converter") || {};
71
+ return this.jsonMapper;
68
72
  }
73
+ /**
74
+ * @deprecated
75
+ */
76
+ // istanbul ignore next
69
77
  set converter(options) {
70
- this.setRaw("converter", options);
78
+ this.jsonMapper = options;
79
+ }
80
+ get jsonMapper() {
81
+ return this.get("jsonMapper") || {};
82
+ }
83
+ set jsonMapper(options) {
84
+ this.setRaw("jsonMapper", options);
85
+ JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);
86
+ JsonMapperSettings.additionalProperties = Boolean(isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === "accept");
71
87
  }
72
88
  get exclude() {
73
89
  return this.get("exclude");
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAM,mBAAmB,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,eAAe,EAAE,UAAU,EAAE,aAAa,EAAgB,MAAM,UAAU,CAAC;AAInF,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,CA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AAE,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;AA5IY,qBAAqB;IAJjC,UAAU,CAAC;QACV,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CA4IjC;SA5IY,qBAAqB","sourcesContent":["import {Env, getHostInfoFromPort} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope, TokenProvider} from \"@tsed/di\";\nimport Https from \"https\";\nimport {ConverterSettings} from \"../interfaces/ConverterSettings\";\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 /**\n * @deprecated\n */\n get componentsScan(): string[] {\n return this.getRaw(\"componentsScan\");\n }\n\n /**\n * @deprecated\n */\n set componentsScan(value: string[]) {\n this.setRaw(\"componentsScan\", 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 converter(): Partial<ConverterSettings> {\n return this.get(\"converter\") || {};\n }\n\n set converter(options: Partial<ConverterSettings>) {\n this.setRaw(\"converter\", options);\n }\n\n get exclude() {\n return this.get(\"exclude\");\n }\n\n set exclude(exclude: string[]) {\n this.setRaw(\"exclude\", exclude);\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"]}
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,EA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esContent":["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 /**\n * @deprecated\n */\n get componentsScan(): string[] {\n return this.getRaw(\"componentsScan\");\n }\n\n /**\n * @deprecated\n */\n set componentsScan(value: string[]) {\n this.setRaw(\"componentsScan\", 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 /**\n * @deprecated\n */\n get converter(): Partial<PlatformJsonMapperSettings> {\n return this.jsonMapper;\n }\n\n /**\n * @deprecated\n */\n // istanbul ignore next\n set converter(options: Partial<PlatformJsonMapperSettings>) {\n this.jsonMapper = options;\n }\n\n get jsonMapper(): Partial<PlatformJsonMapperSettings> {\n return this.get(\"jsonMapper\") || {};\n }\n\n set jsonMapper(options: Partial<PlatformJsonMapperSettings>) {\n this.setRaw(\"jsonMapper\", options);\n\n JsonMapperSettings.disableUnsecureConstructor = Boolean(options.disableUnsecureConstructor);\n JsonMapperSettings.additionalProperties = Boolean(\n isBoolean(options.additionalProperties) ? options.additionalProperties : options.additionalProperties === \"accept\"\n );\n }\n\n get exclude() {\n return this.get(\"exclude\");\n }\n\n set exclude(exclude: string[]) {\n this.setRaw(\"exclude\", exclude);\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
@@ -5,7 +5,7 @@ export * from "./PlatformModule.js";
5
5
  export * from "./exports.js";
6
6
  export * from "./builder/PlatformBuilder.js";
7
7
  export * from "./builder/PlatformControllerBuilder.js";
8
- export * from "./config/interfaces/ConverterSettings.js";
8
+ export * from "./config/interfaces/PlatformJsonMapperSettings.js";
9
9
  export * from "./config/interfaces/PlatformLoggerSettings.js";
10
10
  export * from "./config/interfaces/PlatformMulterSettings.js";
11
11
  export * from "./config/interfaces/PlatformStaticsSettings.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,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,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,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,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./PlatformModule\";\nexport * from \"./exports\";\nexport * from \"./builder/PlatformBuilder\";\nexport * from \"./builder/PlatformControllerBuilder\";\nexport * from \"./config/interfaces/ConverterSettings\";\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/httpServer\";\nexport * from \"./decorators/httpsServer\";\nexport * from \"./decorators/method/endpointFn\";\nexport * from \"./decorators/multer/multerFileSize\";\nexport * from \"./decorators/multer/multerOptions\";\nexport * from \"./decorators/multer/multipartFile\";\nexport * from \"./decorators/params/endpointInfo\";\nexport * from \"./decorators/params/error\";\nexport * from \"./decorators/params/next\";\nexport * from \"./decorators/params/request\";\nexport * from \"./decorators/params/response\";\nexport * from \"./decorators/params/responseData\";\nexport * from \"./domain/AnyToPromiseWithCtx\";\nexport * from \"./domain/ControllerProvider\";\nexport * from \"./domain/EndpointMetadata\";\nexport * from \"./domain/HandlerMetadata\";\nexport * from \"./domain/PlatformContext\";\nexport * from \"./domain/PlatformRouteDetails\";\nexport * from \"./domain/PropertyMetadata\";\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/AcceptMimesMiddleware\";\nexport * from \"./middlewares/GlobalAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformMulterMiddleware\";\nexport * from \"./middlewares/bindEndpointMiddleware\";\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/PlatformRouter\";\nexport * from \"./services/PlatformTest\";\nexport * from \"./utils/createContext\";\nexport * from \"./utils/createHandlerMetadata\";\nexport * from \"./utils/createHttpServer\";\nexport * from \"./utils/createHttpsServer\";\nexport * from \"./utils/createInjector\";\nexport * from \"./utils/getStaticsOptions\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\nexport * from \"./utils/useCtxHandler\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,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,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,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,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,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,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./PlatformModule\";\nexport * from \"./exports\";\nexport * from \"./builder/PlatformBuilder\";\nexport * from \"./builder/PlatformControllerBuilder\";\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/httpServer\";\nexport * from \"./decorators/httpsServer\";\nexport * from \"./decorators/method/endpointFn\";\nexport * from \"./decorators/multer/multerFileSize\";\nexport * from \"./decorators/multer/multerOptions\";\nexport * from \"./decorators/multer/multipartFile\";\nexport * from \"./decorators/params/endpointInfo\";\nexport * from \"./decorators/params/error\";\nexport * from \"./decorators/params/next\";\nexport * from \"./decorators/params/request\";\nexport * from \"./decorators/params/response\";\nexport * from \"./decorators/params/responseData\";\nexport * from \"./domain/AnyToPromiseWithCtx\";\nexport * from \"./domain/ControllerProvider\";\nexport * from \"./domain/EndpointMetadata\";\nexport * from \"./domain/HandlerMetadata\";\nexport * from \"./domain/PlatformContext\";\nexport * from \"./domain/PlatformRouteDetails\";\nexport * from \"./domain/PropertyMetadata\";\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/AcceptMimesMiddleware\";\nexport * from \"./middlewares/GlobalAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformAcceptMimesMiddleware\";\nexport * from \"./middlewares/PlatformMulterMiddleware\";\nexport * from \"./middlewares/bindEndpointMiddleware\";\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/PlatformRouter\";\nexport * from \"./services/PlatformTest\";\nexport * from \"./utils/createContext\";\nexport * from \"./utils/createHandlerMetadata\";\nexport * from \"./utils/createHttpServer\";\nexport * from \"./utils/createHttpsServer\";\nexport * from \"./utils/createInjector\";\nexport * from \"./utils/getStaticsOptions\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\nexport * from \"./utils/useCtxHandler\";\n"]}
@@ -0,0 +1,10 @@
1
+ export interface PlatformJsonMapperSettings {
2
+ /**
3
+ * JsonMapper additional property policy. (see [JsonMapper](/docs/converters.md))
4
+ */
5
+ additionalProperties?: "error" | "accept" | "ignore" | 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 { ConverterSettings } from "../interfaces/ConverterSettings";
5
+ import { PlatformJsonMapperSettings } from "../interfaces/PlatformJsonMapperSettings";
6
6
  /**
7
7
  * `PlatformConfiguration` contains all information about your Server configuration.
8
8
  */
@@ -30,8 +30,16 @@ export declare class PlatformConfiguration extends DIConfiguration {
30
30
  set statics(value: Record<string, (any | string)[]>);
31
31
  get acceptMimes(): string[];
32
32
  set acceptMimes(value: string[]);
33
- get converter(): Partial<ConverterSettings>;
34
- set converter(options: Partial<ConverterSettings>);
33
+ /**
34
+ * @deprecated
35
+ */
36
+ get converter(): Partial<PlatformJsonMapperSettings>;
37
+ /**
38
+ * @deprecated
39
+ */
40
+ set converter(options: Partial<PlatformJsonMapperSettings>);
41
+ get jsonMapper(): Partial<PlatformJsonMapperSettings>;
42
+ set jsonMapper(options: Partial<PlatformJsonMapperSettings>);
35
43
  get exclude(): string[];
36
44
  set exclude(exclude: string[]);
37
45
  /**
@@ -5,7 +5,7 @@ export * from "./PlatformModule";
5
5
  export * from "./exports";
6
6
  export * from "./builder/PlatformBuilder";
7
7
  export * from "./builder/PlatformControllerBuilder";
8
- export * from "./config/interfaces/ConverterSettings";
8
+ export * from "./config/interfaces/PlatformJsonMapperSettings";
9
9
  export * from "./config/interfaces/PlatformLoggerSettings";
10
10
  export * from "./config/interfaces/PlatformMulterSettings";
11
11
  export * from "./config/interfaces/PlatformStaticsSettings";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/common",
3
- "version": "6.128.8",
3
+ "version": "6.128.9",
4
4
  "description": "A TypeScript Framework on top of Express",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -62,22 +62,22 @@
62
62
  }
63
63
  ],
64
64
  "dependencies": {
65
- "@tsed/components-scan": "6.128.8",
66
- "@tsed/core": "6.128.8",
67
- "@tsed/di": "6.128.8",
68
- "@tsed/exceptions": "6.128.8",
69
- "@tsed/json-mapper": "6.128.8",
65
+ "@tsed/components-scan": "6.128.9",
66
+ "@tsed/core": "6.128.9",
67
+ "@tsed/di": "6.128.9",
68
+ "@tsed/exceptions": "6.128.9",
69
+ "@tsed/json-mapper": "6.128.9",
70
70
  "@tsed/logger": ">=6.2.2",
71
71
  "@tsed/logger-file": ">=6.2.2",
72
- "@tsed/perf": "6.128.8",
73
- "@tsed/platform-cache": "6.128.8",
74
- "@tsed/platform-exceptions": "6.128.8",
75
- "@tsed/platform-log-middleware": "6.128.8",
76
- "@tsed/platform-middlewares": "6.128.8",
77
- "@tsed/platform-params": "6.128.8",
78
- "@tsed/platform-response-filter": "6.128.8",
79
- "@tsed/platform-views": "6.128.8",
80
- "@tsed/schema": "6.128.8",
72
+ "@tsed/perf": "6.128.9",
73
+ "@tsed/platform-cache": "6.128.9",
74
+ "@tsed/platform-exceptions": "6.128.9",
75
+ "@tsed/platform-log-middleware": "6.128.9",
76
+ "@tsed/platform-middlewares": "6.128.9",
77
+ "@tsed/platform-params": "6.128.9",
78
+ "@tsed/platform-response-filter": "6.128.9",
79
+ "@tsed/platform-views": "6.128.9",
80
+ "@tsed/schema": "6.128.9",
81
81
  "@types/json-schema": "7.0.11",
82
82
  "@types/on-finished": "2.3.1",
83
83
  "on-finished": "2.4.1",
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 Converter (POJ to Model and Model to POJ),
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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ConverterSettings.js.map
@@ -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,6 +0,0 @@
1
- export interface ConverterSettings {
2
- /**
3
- * Converter additional property policy. (see [Converters](/docs/converters.md))
4
- */
5
- additionalProperties?: "error" | "accept" | "ignore";
6
- }