@tsed/platform-express 6.107.3 → 6.108.0

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.
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformExpress.js","sourceRoot":"","sources":["../../../src/components/PlatformExpress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,yCAUsB;AACtB,qCAAqC;AACrC,wEAAmE;AACnE,uFAAkF;AAClF,6EAAwE;AACxE,+EAA0E;AAC1E,iFAA4E;AAC5E,+EAA0E;AAE1E;;;GAGG;AACH,MAAa,eAAe;IAwB1B,YAAoB,QAA8D;QAA9D,aAAQ,GAAR,QAAQ,CAAsD;QAvBzE,cAAS,GAAG;YACnB;gBACE,OAAO,EAAE,4BAAmB;gBAC5B,QAAQ,EAAE,uDAA0B;aACrC;YACD;gBACE,OAAO,EAAE,uBAAc;gBACvB,QAAQ,EAAE,6CAAqB;aAChC;YACD;gBACE,OAAO,EAAE,wBAAe;gBACxB,QAAQ,EAAE,+CAAsB;aACjC;YACD;gBACE,OAAO,EAAE,yBAAgB;gBACzB,QAAQ,EAAE,iDAAuB;aAClC;YACD;gBACE,OAAO,EAAE,wBAAe;gBACxB,QAAQ,EAAE,+CAAsB;aACjC;SACF,CAAC;IAEmF,CAAC;IAEtF;;;;OAIG;IACH,MAAM,CA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CAAC;gBAC7D,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAgB,aAAa,CAAE,CAAC;gBAClE,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;gBAE7B,aAAa,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,EAAC,SAAS,EAAE,MAAM,EAAC,EAAE,EAAE;oBACzD,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC;gBAEH,aAAa,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;gBACjF,aAAa,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAChE;SACF;QAAC,OAAO,KAAK,EAAE;YACd,uBAAuB;YACvB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,sBAAsB;gBAC7B,OAAO,EAAE,oEAAoE;gBAC7E,KAAK;aACN,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AA3HD,0CA2HC","sourcesContent":["import Express from \"express\";\nimport type {PlatformViews} from \"@tsed/platform-views\";\nimport {\n createContext,\n PlatformAdapter,\n PlatformApplication,\n PlatformBuilder,\n PlatformExceptions,\n PlatformHandler,\n PlatformRequest,\n PlatformResponse,\n PlatformRouter\n} from \"@tsed/common\";\nimport {Env, Type} from \"@tsed/core\";\nimport {rawBodyMiddleware} from \"../middlewares/rawBodyMiddleware\";\nimport {PlatformExpressApplication} from \"../services/PlatformExpressApplication\";\nimport {PlatformExpressRouter} from \"../services/PlatformExpressRouter\";\nimport {PlatformExpressHandler} from \"../services/PlatformExpressHandler\";\nimport {PlatformExpressResponse} from \"../services/PlatformExpressResponse\";\nimport {PlatformExpressRequest} from \"../services/PlatformExpressRequest\";\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpress implements PlatformAdapter<Express.Application, Express.Router> {\n readonly providers = [\n {\n provide: PlatformApplication,\n useClass: PlatformExpressApplication\n },\n {\n provide: PlatformRouter,\n useClass: PlatformExpressRouter\n },\n {\n provide: PlatformHandler,\n useClass: PlatformExpressHandler\n },\n {\n provide: PlatformResponse,\n useClass: PlatformExpressResponse\n },\n {\n provide: PlatformRequest,\n useClass: PlatformExpressRequest\n }\n ];\n\n constructor(private platform: PlatformBuilder<Express.Application, Express.Router>) {}\n\n /**\n * Create new serverless application. In this mode, the component scan are disabled.\n * @param module\n * @param settings\n */\n static create(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {\n return PlatformBuilder.create<Express.Application, Express.Router>(module, {\n ...settings,\n adapter: PlatformExpress\n });\n }\n\n /**\n * Bootstrap a server application\n * @param module\n * @param settings\n */\n static async bootstrap(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {\n return PlatformBuilder.bootstrap<Express.Application, Express.Router>(module, {\n ...settings,\n adapter: PlatformExpress\n });\n }\n\n useRouter(): this {\n const {logger, app} = this.platform;\n\n logger.debug(\"Mount app router\");\n app.getApp().use(rawBodyMiddleware);\n app.getApp().use(app.getRouter());\n\n return this;\n }\n\n async beforeLoadRoutes() {\n const {injector, app} = this.platform;\n // disable x-powered-by header\n injector.settings.get(\"env\") === Env.PROD && app.getApp().disable(\"x-powered-by\");\n\n await this.configureViewsEngine();\n }\n\n async afterLoadRoutes() {\n const {injector, app} = this.platform;\n // NOT FOUND\n app.use((req: any, res: any, next: any) => {\n !res.headersSent && injector.get<PlatformExceptions>(PlatformExceptions)?.resourceNotFound(req.$ctx);\n });\n\n // EXCEPTION FILTERS\n app.use((err: any, req: any, res: any, next: any) => {\n !res.headersSent && injector.get<PlatformExceptions>(PlatformExceptions)?.catch(err, req.$ctx);\n });\n }\n\n useContext(): this {\n const {logger, app, injector} = this.platform;\n\n logger.debug(\"Mount app context\");\n\n const invoke = createContext(injector);\n\n app.getApp().use(async (request: any, response: any, next: any) => {\n await invoke({request, response});\n\n return next();\n });\n\n return this;\n }\n\n private async configureViewsEngine() {\n const {settings, injector, app} = this.platform;\n try {\n const {exists, disabled} = settings.get(\"views\") || {};\n\n if (exists && !disabled) {\n const {PlatformViews} = await import(\"@tsed/platform-views\");\n const platformViews = injector.get<PlatformViews>(PlatformViews)!;\n const express = app.getApp();\n\n platformViews.getEngines().forEach(({extension, engine}) => {\n express.engine(extension, engine.render);\n });\n\n platformViews.viewEngine && express.set(\"view engine\", platformViews.viewEngine);\n platformViews.root && express.set(\"views\", platformViews.root);\n }\n } catch (error) {\n // istanbul ignore next\n injector.logger.warn({\n event: \"PLATFORM_VIEWS_ERROR\",\n message: \"Unable to configure the PlatformViews service on your environment.\",\n error\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformExpress.js","sourceRoot":"","sources":["../../../src/components/PlatformExpress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAUsB;AACtB,qCAAqC;AACrC,wEAAmE;AACnE,uFAAkF;AAClF,6EAAwE;AACxE,+EAA0E;AAC1E,iFAA4E;AAC5E,+EAA0E;AAE1E;;;GAGG;AACH,MAAa,eAAe;IAwB1B,YAAoB,QAA8D;QAA9D,aAAQ,GAAR,QAAQ,CAAsD;QAvBzE,cAAS,GAAG;YACnB;gBACE,OAAO,EAAE,4BAAmB;gBAC5B,QAAQ,EAAE,uDAA0B;aACrC;YACD;gBACE,OAAO,EAAE,uBAAc;gBACvB,QAAQ,EAAE,6CAAqB;aAChC;YACD;gBACE,OAAO,EAAE,wBAAe;gBACxB,QAAQ,EAAE,+CAAsB;aACjC;YACD;gBACE,OAAO,EAAE,yBAAgB;gBACzB,QAAQ,EAAE,iDAAuB;aAClC;YACD;gBACE,OAAO,EAAE,wBAAe;gBACxB,QAAQ,EAAE,+CAAsB;aACjC;SACF,CAAC;IAEmF,CAAC;IAEtF;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,MAAiB,EAAE,WAAwC,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Q,CAAC,GAAG,CAAgB,aAAa,CAAE,CAAC;gBAClE,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;gBAE7B,aAAa,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,EAAC,SAAS,EAAE,MAAM,EAAC,EAAE,EAAE;oBACzD,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC;gBAEH,aAAa,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;gBACjF,aAAa,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAChE;SACF;QAAC,OAAO,KAAK,EAAE;YACd,uBAAuB;YACvB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,sBAAsB;gBAC7B,OAAO,EAAE,oEAAoE;gBAC7E,KAAK;aACN,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AA3HD,0CA2HC","sourcesContent":["import Express from \"express\";\nimport type {PlatformViews} from \"@tsed/platform-views\";\nimport {\n createContext,\n PlatformAdapter,\n PlatformApplication,\n PlatformBuilder,\n PlatformExceptions,\n PlatformHandler,\n PlatformRequest,\n PlatformResponse,\n PlatformRouter\n} from \"@tsed/common\";\nimport {Env, Type} from \"@tsed/core\";\nimport {rawBodyMiddleware} from \"../middlewares/rawBodyMiddleware\";\nimport {PlatformExpressApplication} from \"../services/PlatformExpressApplication\";\nimport {PlatformExpressRouter} from \"../services/PlatformExpressRouter\";\nimport {PlatformExpressHandler} from \"../services/PlatformExpressHandler\";\nimport {PlatformExpressResponse} from \"../services/PlatformExpressResponse\";\nimport {PlatformExpressRequest} from \"../services/PlatformExpressRequest\";\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpress implements PlatformAdapter<Express.Application, Express.Router> {\n readonly providers = [\n {\n provide: PlatformApplication,\n useClass: PlatformExpressApplication\n },\n {\n provide: PlatformRouter,\n useClass: PlatformExpressRouter\n },\n {\n provide: PlatformHandler,\n useClass: PlatformExpressHandler\n },\n {\n provide: PlatformResponse,\n useClass: PlatformExpressResponse\n },\n {\n provide: PlatformRequest,\n useClass: PlatformExpressRequest\n }\n ];\n\n constructor(private platform: PlatformBuilder<Express.Application, Express.Router>) {}\n\n /**\n * Create new serverless application. In this mode, the component scan are disabled.\n * @param module\n * @param settings\n */\n static create(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {\n return PlatformBuilder.create<Express.Application, Express.Router>(module, {\n ...settings,\n adapter: PlatformExpress\n });\n }\n\n /**\n * Bootstrap a server application\n * @param module\n * @param settings\n */\n static async bootstrap(module: Type<any>, settings: Partial<TsED.Configuration> = {}) {\n return PlatformBuilder.bootstrap<Express.Application, Express.Router>(module, {\n ...settings,\n adapter: PlatformExpress\n });\n }\n\n useRouter(): this {\n const {logger, app} = this.platform;\n\n logger.debug(\"Mount app router\");\n app.getApp().use(rawBodyMiddleware);\n app.getApp().use(app.getRouter());\n\n return this;\n }\n\n async beforeLoadRoutes() {\n const {injector, app} = this.platform;\n // disable x-powered-by header\n injector.settings.get(\"env\") === Env.PROD && app.getApp().disable(\"x-powered-by\");\n\n await this.configureViewsEngine();\n }\n\n async afterLoadRoutes() {\n const {injector, app} = this.platform;\n // NOT FOUND\n app.use((req: any, res: any, next: any) => {\n !res.headersSent && injector.get<PlatformExceptions>(PlatformExceptions)?.resourceNotFound(req.$ctx);\n });\n\n // EXCEPTION FILTERS\n app.use((err: any, req: any, res: any, next: any) => {\n !res.headersSent && injector.get<PlatformExceptions>(PlatformExceptions)?.catch(err, req.$ctx);\n });\n }\n\n useContext(): this {\n const {logger, app, injector} = this.platform;\n\n logger.debug(\"Mount app context\");\n\n const invoke = createContext(injector);\n\n app.getApp().use(async (request: any, response: any, next: any) => {\n await invoke({request, response});\n\n return next();\n });\n\n return this;\n }\n\n private async configureViewsEngine() {\n const {settings, injector, app} = this.platform;\n try {\n const {exists, disabled} = settings.get(\"views\") || {};\n\n if (exists && !disabled) {\n const {PlatformViews} = await import(\"@tsed/platform-views\");\n const platformViews = injector.get<PlatformViews>(PlatformViews)!;\n const express = app.getApp();\n\n platformViews.getEngines().forEach(({extension, engine}) => {\n express.engine(extension, engine.render);\n });\n\n platformViews.viewEngine && express.set(\"view engine\", platformViews.viewEngine);\n platformViews.root && express.set(\"views\", platformViews.root);\n }\n } catch (error) {\n // istanbul ignore next\n injector.logger.warn({\n event: \"PLATFORM_VIEWS_ERROR\",\n message: \"Unable to configure the PlatformViews service on your environment.\",\n error\n });\n }\n }\n}\n"]}
package/lib/cjs/index.js CHANGED
@@ -4,20 +4,20 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const tslib_1 = require("tslib");
7
- (0, tslib_1.__exportStar)(require("./exports"), exports);
8
- (0, tslib_1.__exportStar)(require("./components/PlatformExpress"), exports);
9
- (0, tslib_1.__exportStar)(require("./decorators/caseSensitive"), exports);
10
- (0, tslib_1.__exportStar)(require("./decorators/mergeParams"), exports);
11
- (0, tslib_1.__exportStar)(require("./decorators/routerSettings"), exports);
12
- (0, tslib_1.__exportStar)(require("./decorators/strict"), exports);
13
- (0, tslib_1.__exportStar)(require("./interfaces/PlatformExpressSettings"), exports);
14
- (0, tslib_1.__exportStar)(require("./interfaces/PlatformExpressStaticsOptions"), exports);
15
- (0, tslib_1.__exportStar)(require("./interfaces/interfaces"), exports);
16
- (0, tslib_1.__exportStar)(require("./middlewares/rawBodyMiddleware"), exports);
17
- (0, tslib_1.__exportStar)(require("./middlewares/staticsMiddleware"), exports);
18
- (0, tslib_1.__exportStar)(require("./services/PlatformExpressApplication"), exports);
19
- (0, tslib_1.__exportStar)(require("./services/PlatformExpressHandler"), exports);
20
- (0, tslib_1.__exportStar)(require("./services/PlatformExpressRequest"), exports);
21
- (0, tslib_1.__exportStar)(require("./services/PlatformExpressResponse"), exports);
22
- (0, tslib_1.__exportStar)(require("./services/PlatformExpressRouter"), exports);
7
+ tslib_1.__exportStar(require("./exports"), exports);
8
+ tslib_1.__exportStar(require("./components/PlatformExpress"), exports);
9
+ tslib_1.__exportStar(require("./decorators/caseSensitive"), exports);
10
+ tslib_1.__exportStar(require("./decorators/mergeParams"), exports);
11
+ tslib_1.__exportStar(require("./decorators/routerSettings"), exports);
12
+ tslib_1.__exportStar(require("./decorators/strict"), exports);
13
+ tslib_1.__exportStar(require("./interfaces/PlatformExpressSettings"), exports);
14
+ tslib_1.__exportStar(require("./interfaces/PlatformExpressStaticsOptions"), exports);
15
+ tslib_1.__exportStar(require("./interfaces/interfaces"), exports);
16
+ tslib_1.__exportStar(require("./middlewares/rawBodyMiddleware"), exports);
17
+ tslib_1.__exportStar(require("./middlewares/staticsMiddleware"), exports);
18
+ tslib_1.__exportStar(require("./services/PlatformExpressApplication"), exports);
19
+ tslib_1.__exportStar(require("./services/PlatformExpressHandler"), exports);
20
+ tslib_1.__exportStar(require("./services/PlatformExpressRequest"), exports);
21
+ tslib_1.__exportStar(require("./services/PlatformExpressResponse"), exports);
22
+ tslib_1.__exportStar(require("./services/PlatformExpressRouter"), exports);
23
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,yDAA0B;AAC1B,4EAA6C;AAC7C,0EAA2C;AAC3C,wEAAyC;AACzC,2EAA4C;AAC5C,mEAAoC;AACpC,oFAAqD;AACrD,0FAA2D;AAC3D,uEAAwC;AACxC,+EAAgD;AAChD,+EAAgD;AAChD,qFAAsD;AACtD,iFAAkD;AAClD,iFAAkD;AAClD,kFAAmD;AACnD,gFAAiD","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./exports\";\nexport * from \"./components/PlatformExpress\";\nexport * from \"./decorators/caseSensitive\";\nexport * from \"./decorators/mergeParams\";\nexport * from \"./decorators/routerSettings\";\nexport * from \"./decorators/strict\";\nexport * from \"./interfaces/PlatformExpressSettings\";\nexport * from \"./interfaces/PlatformExpressStaticsOptions\";\nexport * from \"./interfaces/interfaces\";\nexport * from \"./middlewares/rawBodyMiddleware\";\nexport * from \"./middlewares/staticsMiddleware\";\nexport * from \"./services/PlatformExpressApplication\";\nexport * from \"./services/PlatformExpressHandler\";\nexport * from \"./services/PlatformExpressRequest\";\nexport * from \"./services/PlatformExpressResponse\";\nexport * from \"./services/PlatformExpressRouter\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAA0B;AAC1B,uEAA6C;AAC7C,qEAA2C;AAC3C,mEAAyC;AACzC,sEAA4C;AAC5C,8DAAoC;AACpC,+EAAqD;AACrD,qFAA2D;AAC3D,kEAAwC;AACxC,0EAAgD;AAChD,0EAAgD;AAChD,gFAAsD;AACtD,4EAAkD;AAClD,4EAAkD;AAClD,6EAAmD;AACnD,2EAAiD","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./exports\";\nexport * from \"./components/PlatformExpress\";\nexport * from \"./decorators/caseSensitive\";\nexport * from \"./decorators/mergeParams\";\nexport * from \"./decorators/routerSettings\";\nexport * from \"./decorators/strict\";\nexport * from \"./interfaces/PlatformExpressSettings\";\nexport * from \"./interfaces/PlatformExpressStaticsOptions\";\nexport * from \"./interfaces/interfaces\";\nexport * from \"./middlewares/rawBodyMiddleware\";\nexport * from \"./middlewares/staticsMiddleware\";\nexport * from \"./services/PlatformExpressApplication\";\nexport * from \"./services/PlatformExpressHandler\";\nexport * from \"./services/PlatformExpressRequest\";\nexport * from \"./services/PlatformExpressResponse\";\nexport * from \"./services/PlatformExpressRouter\";\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rawBodyMiddleware = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const bytes_1 = (0, tslib_1.__importDefault)(require("bytes"));
5
+ const bytes_1 = tslib_1.__importDefault(require("bytes"));
6
6
  const limit = bytes_1.default.parse("100kb");
7
7
  function isLimitReached(length) {
8
8
  return limit !== null && length !== null && length > limit;
@@ -1 +1 @@
1
- {"version":3,"file":"rawBodyMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/rawBodyMiddleware.ts"],"names":[],"mappings":";;;;AACA,+DAA0B;AAE1B,MAAM,KAAK,GAAG,eAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAEnC,SAAS,cAAc,CAAC,MAAqB;IAC3C,OAAO,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,GAAG,KAAK,CAAC;AAC7D,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAoC;IAC5D,MAAM,aAAa,GAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACzD,OAAO,aAAa,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7F,CAAC;AAED,SAAgB,iBAAiB,CAAC,OAAoC,EAAE,QAAa,EAAE,IAAS;IAC9F,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;QAC5B,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,CAAC,EAAE;YACpG,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;YACrB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;gBACnC,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;YAC3B,CAAC,CAAC,CAAC;SACJ;KACF;IAED,IAAI,EAAE,CAAC;AACT,CAAC;AAbD,8CAaC","sourcesContent":["import {Request} from \"express\";\nimport bytes from \"bytes\";\n\nconst limit = bytes.parse(\"100kb\");\n\nfunction isLimitReached(length: number | null) {\n return limit !== null && length !== null && length > limit;\n}\n\nfunction getContentLength(request: Request & {rawBody: string}) {\n const contentLength: any = request.get(\"content-length\");\n return contentLength != null && !isNaN(contentLength) ? parseInt(contentLength, 10) : null;\n}\n\nexport function rawBodyMiddleware(request: Request & {rawBody: string}, response: any, next: any) {\n if (request.method !== \"GET\") {\n const length = getContentLength(request);\n\n if (!isLimitReached(length) && request.is([\"application/x-www-form-urlencoded\", \"application/json\"])) {\n request.rawBody = \"\";\n request.on(\"data\", (chunk: string) => {\n request.rawBody += chunk;\n });\n }\n }\n\n next();\n}\n"]}
1
+ {"version":3,"file":"rawBodyMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/rawBodyMiddleware.ts"],"names":[],"mappings":";;;;AACA,0DAA0B;AAE1B,MAAM,KAAK,GAAG,eAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAEnC,SAAS,cAAc,CAAC,MAAqB;IAC3C,OAAO,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,GAAG,KAAK,CAAC;AAC7D,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAoC;IAC5D,MAAM,aAAa,GAAQ,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACzD,OAAO,aAAa,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7F,CAAC;AAED,SAAgB,iBAAiB,CAAC,OAAoC,EAAE,QAAa,EAAE,IAAS;IAC9F,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;QAC5B,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,CAAC,EAAE;YACpG,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;YACrB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;gBACnC,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;YAC3B,CAAC,CAAC,CAAC;SACJ;KACF;IAED,IAAI,EAAE,CAAC;AACT,CAAC;AAbD,8CAaC","sourcesContent":["import {Request} from \"express\";\nimport bytes from \"bytes\";\n\nconst limit = bytes.parse(\"100kb\");\n\nfunction isLimitReached(length: number | null) {\n return limit !== null && length !== null && length > limit;\n}\n\nfunction getContentLength(request: Request & {rawBody: string}) {\n const contentLength: any = request.get(\"content-length\");\n return contentLength != null && !isNaN(contentLength) ? parseInt(contentLength, 10) : null;\n}\n\nexport function rawBodyMiddleware(request: Request & {rawBody: string}, response: any, next: any) {\n if (request.method !== \"GET\") {\n const length = getContentLength(request);\n\n if (!isLimitReached(length) && request.is([\"application/x-www-form-urlencoded\", \"application/json\"])) {\n request.rawBody = \"\";\n request.on(\"data\", (chunk: string) => {\n request.rawBody += chunk;\n });\n }\n }\n\n next();\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.staticsMiddleware = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const express_1 = (0, tslib_1.__importDefault)(require("express"));
5
+ const express_1 = tslib_1.__importDefault(require("express"));
6
6
  /**
7
7
  * @ignore
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"staticsMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/staticsMiddleware.ts"],"names":[],"mappings":";;;;AAAA,mEAA8B;AAE9B;;GAEG;AACH,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,UAAe,EAAE;IACpE,MAAM,UAAU,GAAG,iBAAO,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEtD,OAAO,CAAC,OAAY,EAAE,QAAa,EAAE,IAAS,EAAE,EAAE;QAChD,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;YACzB,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;SACrC;aAAM;YACL,IAAI,EAAE,CAAC;SACR;IACH,CAAC,CAAC;AACJ,CAAC;AAVD,8CAUC","sourcesContent":["import Express from \"express\";\n\n/**\n * @ignore\n */\nexport function staticsMiddleware(directory: string, options: any = {}) {\n const middleware = Express.static(directory, options);\n\n return (request: any, response: any, next: any) => {\n if (!response.headersSent) {\n middleware(request, response, next);\n } else {\n next();\n }\n };\n}\n"]}
1
+ {"version":3,"file":"staticsMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/staticsMiddleware.ts"],"names":[],"mappings":";;;;AAAA,8DAA8B;AAE9B;;GAEG;AACH,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,UAAe,EAAE;IACpE,MAAM,UAAU,GAAG,iBAAO,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEtD,OAAO,CAAC,OAAY,EAAE,QAAa,EAAE,IAAS,EAAE,EAAE;QAChD,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;YACzB,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;SACrC;aAAM;YACL,IAAI,EAAE,CAAC;SACR;IACH,CAAC,CAAC;AACJ,CAAC;AAVD,8CAUC","sourcesContent":["import Express from \"express\";\n\n/**\n * @ignore\n */\nexport function staticsMiddleware(directory: string, options: any = {}) {\n const middleware = Express.static(directory, options);\n\n return (request: any, response: any, next: any) => {\n if (!response.headersSent) {\n middleware(request, response, next);\n } else {\n next();\n }\n };\n}\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlatformExpressApplication = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@tsed/common");
6
- const express_1 = (0, tslib_1.__importDefault)(require("express"));
6
+ const express_1 = tslib_1.__importDefault(require("express"));
7
7
  const PlatformExpressRouter_1 = require("./PlatformExpressRouter");
8
8
  /**
9
9
  * @platform
@@ -23,10 +23,10 @@ let PlatformExpressApplication = class PlatformExpressApplication extends Platfo
23
23
  return this.rawApp;
24
24
  }
25
25
  };
26
- PlatformExpressApplication = (0, tslib_1.__decorate)([
27
- (0, tslib_1.__param)(0, (0, common_1.Inject)()),
28
- (0, tslib_1.__param)(1, (0, common_1.Configuration)()),
29
- (0, tslib_1.__metadata)("design:paramtypes", [common_1.PlatformHandler, Object])
26
+ PlatformExpressApplication = tslib_1.__decorate([
27
+ tslib_1.__param(0, (0, common_1.Inject)()),
28
+ tslib_1.__param(1, (0, common_1.Configuration)()),
29
+ tslib_1.__metadata("design:paramtypes", [common_1.PlatformHandler, Object])
30
30
  ], PlatformExpressApplication);
31
31
  exports.PlatformExpressApplication = PlatformExpressApplication;
32
32
  //# sourceMappingURL=PlatformExpressApplication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformExpressApplication.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressApplication.ts"],"names":[],"mappings":";;;;AAAA,yCAAwG;AACxG,mEAA8B;AAE9B,mEAA8D;AAU9D;;;GAGG;AACH,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,6CAAqB;IAKnE,YAAsB,eAAgC,EAAmB,aAA4B;QACnG,KAAK,CAAC,eAAe,EAAE,aAAa,EAAE;YACpC,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,IAAA,iBAAO,GAAE,CAAC;IAC9D,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAA;AApBY,0BAA0B;IAKxB,wBAAA,IAAA,eAAM,GAAE,CAAA;IAAoC,wBAAA,IAAA,sBAAa,GAAE,CAAA;kDAAjC,wBAAe;GAL3C,0BAA0B,CAoBtC;AApBY,gEAA0B","sourcesContent":["import {Configuration, createContext, Inject, PlatformApplication, PlatformHandler} from \"@tsed/common\";\nimport Express from \"express\";\nimport {PlatformExpressStaticsOptions} from \"../interfaces/PlatformExpressStaticsOptions\";\nimport {PlatformExpressRouter} from \"./PlatformExpressRouter\";\n\ndeclare global {\n namespace TsED {\n export interface Application extends Express.Application {}\n\n export interface StaticsOptions extends PlatformExpressStaticsOptions {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressApplication extends PlatformExpressRouter implements PlatformApplication<Express.Application, Express.Router> {\n app: Express.Application;\n rawApp: Express.Application;\n rawRouter: Express.Router;\n\n constructor(@Inject() platformHandler: PlatformHandler, @Configuration() configuration: Configuration) {\n super(platformHandler, configuration, {\n mergeParams: true\n });\n\n this.rawApp = configuration.get(\"express.app\") || Express();\n }\n\n getApp() {\n return this.rawApp;\n }\n\n callback() {\n return this.rawApp;\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformExpressApplication.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressApplication.ts"],"names":[],"mappings":";;;;AAAA,yCAAyF;AACzF,8DAA8B;AAE9B,mEAA8D;AAU9D;;;GAGG;AACH,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,6CAAqB;IAKnE,YAAsB,eAAgC,EAAmB,aAA4B;QACnG,KAAK,CAAC,eAAe,EAAE,aAAa,EAAE;YACpC,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,IAAA,iBAAO,GAAE,CAAC;IAC9D,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAA;AApBY,0BAA0B;IAKxB,mBAAA,IAAA,eAAM,GAAE,CAAA;IAAoC,mBAAA,IAAA,sBAAa,GAAE,CAAA;6CAAjC,wBAAe;GAL3C,0BAA0B,CAoBtC;AApBY,gEAA0B","sourcesContent":["import {Configuration, Inject, PlatformApplication, PlatformHandler} from \"@tsed/common\";\nimport Express from \"express\";\nimport {PlatformExpressStaticsOptions} from \"../interfaces/PlatformExpressStaticsOptions\";\nimport {PlatformExpressRouter} from \"./PlatformExpressRouter\";\n\ndeclare global {\n namespace TsED {\n export interface Application extends Express.Application {}\n\n export interface StaticsOptions extends PlatformExpressStaticsOptions {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressApplication extends PlatformExpressRouter implements PlatformApplication<Express.Application, Express.Router> {\n app: Express.Application;\n rawApp: Express.Application;\n rawRouter: Express.Router;\n\n constructor(@Inject() platformHandler: PlatformHandler, @Configuration() configuration: Configuration) {\n super(platformHandler, configuration, {\n mergeParams: true\n });\n\n this.rawApp = configuration.get(\"express.app\") || Express();\n }\n\n getApp() {\n return this.rawApp;\n }\n\n callback() {\n return this.rawApp;\n }\n}\n"]}
@@ -4,7 +4,7 @@ exports.PlatformExpressRouter = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@tsed/common");
6
6
  const di_1 = require("@tsed/di");
7
- const express_1 = (0, tslib_1.__importDefault)(require("express"));
7
+ const express_1 = tslib_1.__importDefault(require("express"));
8
8
  const staticsMiddleware_1 = require("../middlewares/staticsMiddleware");
9
9
  /**
10
10
  * @platform
@@ -25,10 +25,10 @@ let PlatformExpressRouter = class PlatformExpressRouter extends common_1.Platfor
25
25
  return this;
26
26
  }
27
27
  };
28
- PlatformExpressRouter = (0, tslib_1.__decorate)([
29
- (0, tslib_1.__param)(1, (0, di_1.Configuration)()),
30
- (0, tslib_1.__param)(2, (0, di_1.Inject)(common_1.PLATFORM_ROUTER_OPTIONS)),
31
- (0, tslib_1.__metadata)("design:paramtypes", [common_1.PlatformHandler, Object, Object])
28
+ PlatformExpressRouter = tslib_1.__decorate([
29
+ tslib_1.__param(1, (0, di_1.Configuration)()),
30
+ tslib_1.__param(2, (0, di_1.Inject)(common_1.PLATFORM_ROUTER_OPTIONS)),
31
+ tslib_1.__metadata("design:paramtypes", [common_1.PlatformHandler, Object, Object])
32
32
  ], PlatformExpressRouter);
33
33
  exports.PlatformExpressRouter = PlatformExpressRouter;
34
34
  //# sourceMappingURL=PlatformExpressRouter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformExpressRouter.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressRouter.ts"],"names":[],"mappings":";;;;AAAA,yCAA8G;AAC9G,iCAA+C;AAC/C,mEAA8B;AAE9B,wEAAmE;AAQnE;;;GAGG;AACH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,uBAA8B;IACvE,YACE,QAAyB,EACR,aAA4B,EACZ,gBAAwC,EAAE;;QAE3E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEhB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC3B;YACE,WAAW,EAAE,IAAI;SAClB,EACD,CAAA,MAAA,aAAa,CAAC,OAAO,0CAAE,MAAM,KAAI,EAAE,EACnC,aAAa,CACd,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,GAAG,iBAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAA+B;QACvD,MAAM,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,GAAG,OAAO,CAAC;QAEjC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,qCAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAzBY,qBAAqB;IAG7B,wBAAA,IAAA,kBAAa,GAAE,CAAA;IACf,wBAAA,IAAA,WAAM,EAAC,gCAAuB,CAAC,CAAA;kDAFtB,wBAAe;GAFhB,qBAAqB,CAyBjC;AAzBY,sDAAqB","sourcesContent":["import {PLATFORM_ROUTER_OPTIONS, PlatformHandler, PlatformRouter, PlatformStaticsOptions} from \"@tsed/common\";\nimport {Configuration, Inject} from \"@tsed/di\";\nimport Express from \"express\";\nimport {RouterOptions} from \"express\";\nimport {staticsMiddleware} from \"../middlewares/staticsMiddleware\";\n\ndeclare global {\n namespace TsED {\n export interface Router extends Express.Router {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressRouter extends PlatformRouter<Express.Router> {\n constructor(\n platform: PlatformHandler,\n @Configuration() configuration: Configuration,\n @Inject(PLATFORM_ROUTER_OPTIONS) routerOptions: Partial<RouterOptions> = {}\n ) {\n super(platform);\n\n const options = Object.assign(\n {\n mergeParams: true\n },\n configuration.express?.router || {},\n routerOptions\n );\n this.rawRouter = this.raw = Express.Router(options);\n }\n\n statics(endpoint: string, options: PlatformStaticsOptions) {\n const {root, ...props} = options;\n\n this.use(endpoint, staticsMiddleware(root, props));\n\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformExpressRouter.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressRouter.ts"],"names":[],"mappings":";;;;AAAA,yCAA8G;AAC9G,iCAA+C;AAC/C,8DAA8B;AAE9B,wEAAmE;AAQnE;;;GAGG;AACH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,uBAA8B;IACvE,YACE,QAAyB,EACR,aAA4B,EACZ,gBAAwC,EAAE;;QAE3E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEhB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC3B;YACE,WAAW,EAAE,IAAI;SAClB,EACD,CAAA,MAAA,aAAa,CAAC,OAAO,0CAAE,MAAM,KAAI,EAAE,EACnC,aAAa,CACd,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,GAAG,iBAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAA+B;QACvD,MAAM,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,GAAG,OAAO,CAAC;QAEjC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,qCAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAzBY,qBAAqB;IAG7B,mBAAA,IAAA,kBAAa,GAAE,CAAA;IACf,mBAAA,IAAA,WAAM,EAAC,gCAAuB,CAAC,CAAA;6CAFtB,wBAAe;GAFhB,qBAAqB,CAyBjC;AAzBY,sDAAqB","sourcesContent":["import {PLATFORM_ROUTER_OPTIONS, PlatformHandler, PlatformRouter, PlatformStaticsOptions} from \"@tsed/common\";\nimport {Configuration, Inject} from \"@tsed/di\";\nimport Express from \"express\";\nimport {RouterOptions} from \"express\";\nimport {staticsMiddleware} from \"../middlewares/staticsMiddleware\";\n\ndeclare global {\n namespace TsED {\n export interface Router extends Express.Router {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressRouter extends PlatformRouter<Express.Router> {\n constructor(\n platform: PlatformHandler,\n @Configuration() configuration: Configuration,\n @Inject(PLATFORM_ROUTER_OPTIONS) routerOptions: Partial<RouterOptions> = {}\n ) {\n super(platform);\n\n const options = Object.assign(\n {\n mergeParams: true\n },\n configuration.express?.router || {},\n routerOptions\n );\n this.rawRouter = this.raw = Express.Router(options);\n }\n\n statics(endpoint: string, options: PlatformStaticsOptions) {\n const {root, ...props} = options;\n\n this.use(endpoint, staticsMiddleware(root, props));\n\n return this;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformExpressApplication.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressApplication.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,aAAa,EAAiB,MAAM,EAAuB,eAAe,EAAC,MAAM,cAAc,CAAC;AACxG,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAU9D;;;GAGG;AACH,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,qBAAqB;IAKnE,YAAsB,eAAgC,EAAmB,aAA4B;QACnG,KAAK,CAAC,eAAe,EAAE,aAAa,EAAE;YACpC,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,EAAE,CAAC;IAC9D,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAA;AApBY,0BAA0B;IAKxB,WAAA,MAAM,EAAE,CAAA;IAAoC,WAAA,aAAa,EAAE,CAAA;qCAAjC,eAAe;GAL3C,0BAA0B,CAoBtC;SApBY,0BAA0B","sourcesContent":["import {Configuration, createContext, Inject, PlatformApplication, PlatformHandler} from \"@tsed/common\";\nimport Express from \"express\";\nimport {PlatformExpressStaticsOptions} from \"../interfaces/PlatformExpressStaticsOptions\";\nimport {PlatformExpressRouter} from \"./PlatformExpressRouter\";\n\ndeclare global {\n namespace TsED {\n export interface Application extends Express.Application {}\n\n export interface StaticsOptions extends PlatformExpressStaticsOptions {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressApplication extends PlatformExpressRouter implements PlatformApplication<Express.Application, Express.Router> {\n app: Express.Application;\n rawApp: Express.Application;\n rawRouter: Express.Router;\n\n constructor(@Inject() platformHandler: PlatformHandler, @Configuration() configuration: Configuration) {\n super(platformHandler, configuration, {\n mergeParams: true\n });\n\n this.rawApp = configuration.get(\"express.app\") || Express();\n }\n\n getApp() {\n return this.rawApp;\n }\n\n callback() {\n return this.rawApp;\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformExpressApplication.js","sourceRoot":"","sources":["../../../src/services/PlatformExpressApplication.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,aAAa,EAAE,MAAM,EAAuB,eAAe,EAAC,MAAM,cAAc,CAAC;AACzF,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAU9D;;;GAGG;AACH,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,qBAAqB;IAKnE,YAAsB,eAAgC,EAAmB,aAA4B;QACnG,KAAK,CAAC,eAAe,EAAE,aAAa,EAAE;YACpC,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,EAAE,CAAC;IAC9D,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAA;AApBY,0BAA0B;IAKxB,WAAA,MAAM,EAAE,CAAA;IAAoC,WAAA,aAAa,EAAE,CAAA;qCAAjC,eAAe;GAL3C,0BAA0B,CAoBtC;SApBY,0BAA0B","sourcesContent":["import {Configuration, Inject, PlatformApplication, PlatformHandler} from \"@tsed/common\";\nimport Express from \"express\";\nimport {PlatformExpressStaticsOptions} from \"../interfaces/PlatformExpressStaticsOptions\";\nimport {PlatformExpressRouter} from \"./PlatformExpressRouter\";\n\ndeclare global {\n namespace TsED {\n export interface Application extends Express.Application {}\n\n export interface StaticsOptions extends PlatformExpressStaticsOptions {}\n }\n}\n\n/**\n * @platform\n * @express\n */\nexport class PlatformExpressApplication extends PlatformExpressRouter implements PlatformApplication<Express.Application, Express.Router> {\n app: Express.Application;\n rawApp: Express.Application;\n rawRouter: Express.Router;\n\n constructor(@Inject() platformHandler: PlatformHandler, @Configuration() configuration: Configuration) {\n super(platformHandler, configuration, {\n mergeParams: true\n });\n\n this.rawApp = configuration.get(\"express.app\") || Express();\n }\n\n getApp() {\n return this.rawApp;\n }\n\n callback() {\n return this.rawApp;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-express",
3
- "version": "6.107.3",
3
+ "version": "6.108.0",
4
4
  "description": "A TypeScript Framework on top of Express",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -53,43 +53,64 @@
53
53
  "dependencies": {
54
54
  "express": "^4.17.1",
55
55
  "multer": "^1.4.2",
56
- "tslib": "2.2.0"
56
+ "tslib": "2.3.1"
57
57
  },
58
58
  "devDependencies": {
59
- "@tsed/common": "6.107.3",
60
- "@tsed/core": "6.107.3",
61
- "@tsed/di": "6.107.3",
62
- "@tsed/platform-test-utils": "6.107.3",
63
- "@tsed/platform-views": "6.107.3",
64
- "@types/body-parser": "1.19.0",
65
- "@types/compression": "1.7.0",
59
+ "@tsed/common": "6.108.0",
60
+ "@tsed/core": "6.108.0",
61
+ "@tsed/di": "6.108.0",
62
+ "@tsed/platform-test-utils": "6.108.0",
63
+ "@tsed/platform-views": "6.108.0",
64
+ "@types/body-parser": "1.19.2",
65
+ "@types/compression": "1.7.2",
66
66
  "@types/cookie-parser": "1.4.2",
67
67
  "@types/express": "^4.17.7",
68
- "@types/express-session": "1.17.0",
69
- "@types/method-override": "0.0.31",
68
+ "@types/express-session": "1.17.4",
69
+ "@types/method-override": "0.0.32",
70
70
  "@types/multer": "^1.4.3",
71
- "body-parser": "1.19.0",
71
+ "body-parser": "1.19.2",
72
72
  "compression": "1.7.4",
73
- "cookie-parser": "1.4.5",
73
+ "cookie-parser": "1.4.6",
74
74
  "cors": "2.8.5",
75
- "express-session": "1.17.1",
75
+ "express-session": "1.17.2",
76
76
  "method-override": "3.0.0"
77
77
  },
78
78
  "peerDependencies": {
79
- "@tsed/common": "^6.107.3",
80
- "@tsed/core": "^6.107.3",
81
- "@tsed/di": "^6.107.3",
82
- "@tsed/json-mapper": "^6.107.3",
83
- "@tsed/logger": ">=6.1.0",
84
- "@tsed/openspec": "^6.107.3",
85
- "@tsed/platform-views": "^6.107.3",
86
- "@tsed/schema": "^6.107.3",
79
+ "@tsed/common": "^6.108.0",
80
+ "@tsed/core": "^6.108.0",
81
+ "@tsed/di": "^6.108.0",
82
+ "@tsed/json-mapper": "^6.108.0",
83
+ "@tsed/logger": ">=6.1.1",
84
+ "@tsed/openspec": "^6.108.0",
85
+ "@tsed/platform-views": "^6.108.0",
86
+ "@tsed/schema": "^6.108.0",
87
87
  "@types/multer": "^1.4.5",
88
88
  "body-parser": "1.19.0"
89
89
  },
90
90
  "peerDependenciesMeta": {
91
+ "@tsed/common": {
92
+ "optional": false
93
+ },
94
+ "@tsed/core": {
95
+ "optional": false
96
+ },
97
+ "@tsed/di": {
98
+ "optional": false
99
+ },
100
+ "@tsed/json-mapper": {
101
+ "optional": false
102
+ },
103
+ "@tsed/openspec": {
104
+ "optional": false
105
+ },
91
106
  "@tsed/platform-views": {
92
107
  "optional": true
108
+ },
109
+ "@tsed/schema": {
110
+ "optional": false
111
+ },
112
+ "@tsed/logger": {
113
+ "optional": false
93
114
  }
94
115
  }
95
116
  }