@tsed/common 6.107.4 → 6.109.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.
Files changed (48) hide show
  1. package/lib/cjs/builder/PlatformBuilder.js +25 -21
  2. package/lib/cjs/builder/PlatformBuilder.js.map +1 -1
  3. package/lib/cjs/config/services/PlatformConfiguration.js +2 -2
  4. package/lib/cjs/exports.js +8 -8
  5. package/lib/cjs/exports.js.map +1 -1
  6. package/lib/cjs/index.js +73 -73
  7. package/lib/cjs/index.js.map +1 -1
  8. package/lib/cjs/middlewares/AcceptMimesMiddleware.js +6 -6
  9. package/lib/cjs/middlewares/AcceptMimesMiddleware.js.map +1 -1
  10. package/lib/cjs/middlewares/GlobalAcceptMimesMiddleware.js +6 -6
  11. package/lib/cjs/middlewares/GlobalAcceptMimesMiddleware.js.map +1 -1
  12. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +8 -8
  13. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
  14. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +10 -10
  15. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -1
  16. package/lib/cjs/middlewares/__mock__/FakeCtrl.js +1 -1
  17. package/lib/cjs/services/Platform.js +2 -2
  18. package/lib/cjs/services/Platform.js.map +1 -1
  19. package/lib/cjs/services/PlatformApplication.js +2 -2
  20. package/lib/cjs/services/PlatformApplication.js.map +1 -1
  21. package/lib/cjs/services/PlatformHandler.js +4 -4
  22. package/lib/cjs/services/PlatformHandler.js.map +1 -1
  23. package/lib/cjs/services/PlatformMiddlewaresChain.js +3 -3
  24. package/lib/cjs/services/PlatformRequest.js +2 -2
  25. package/lib/cjs/services/PlatformResponse.js +4 -4
  26. package/lib/cjs/services/PlatformResponse.js.map +1 -1
  27. package/lib/cjs/services/PlatformRouter.js +6 -6
  28. package/lib/cjs/services/PlatformRouter.js.map +1 -1
  29. package/lib/cjs/services/PlatformTest.js +1 -1
  30. package/lib/cjs/services/PlatformTest.js.map +1 -1
  31. package/lib/cjs/utils/createHttpServer.js +3 -2
  32. package/lib/cjs/utils/createHttpServer.js.map +1 -1
  33. package/lib/cjs/utils/createHttpsServer.js +3 -2
  34. package/lib/cjs/utils/createHttpsServer.js.map +1 -1
  35. package/lib/cjs/utils/setResponseHeaders.js.map +1 -1
  36. package/lib/esm/builder/PlatformBuilder.js +8 -4
  37. package/lib/esm/builder/PlatformBuilder.js.map +1 -1
  38. package/lib/esm/services/PlatformResponse.js.map +1 -1
  39. package/lib/esm/utils/createHttpServer.js +2 -1
  40. package/lib/esm/utils/createHttpServer.js.map +1 -1
  41. package/lib/esm/utils/createHttpsServer.js +2 -1
  42. package/lib/esm/utils/createHttpsServer.js.map +1 -1
  43. package/lib/esm/utils/setResponseHeaders.js.map +1 -1
  44. package/lib/types/builder/PlatformBuilder.d.ts +1 -1
  45. package/lib/types/services/PlatformResponse.d.ts +4 -4
  46. package/lib/types/utils/createHttpServer.d.ts +1 -1
  47. package/lib/types/utils/createHttpsServer.d.ts +2 -1
  48. package/package.json +30 -24
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var _PlatformBuilder_injector, _PlatformBuilder_rootModule, _PlatformBuilder_promise, _PlatformBuilder_adapter, _PlatformBuilder_servers;
2
+ var _PlatformBuilder_injector, _PlatformBuilder_rootModule, _PlatformBuilder_promise, _PlatformBuilder_adapter, _PlatformBuilder_servers, _PlatformBuilder_listeners;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.PlatformBuilder = void 0;
5
5
  const tslib_1 = require("tslib");
@@ -29,26 +29,27 @@ class PlatformBuilder {
29
29
  _PlatformBuilder_promise.set(this, void 0);
30
30
  _PlatformBuilder_adapter.set(this, void 0);
31
31
  _PlatformBuilder_servers.set(this, void 0);
32
- (0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_rootModule, module, "f");
32
+ _PlatformBuilder_listeners.set(this, []);
33
+ tslib_1.__classPrivateFieldSet(this, _PlatformBuilder_rootModule, module, "f");
33
34
  const adapterKlass = adapter || PlatformBuilder.adapter;
34
35
  const name = (0, core_1.nameOf)(adapterKlass).replace("Platform", "").toLowerCase();
35
36
  const configuration = (0, getConfiguration_1.getConfiguration)(settings, module);
36
37
  configuration.PLATFORM_NAME = name;
37
38
  this.name = name;
38
- (0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_adapter, new adapterKlass(this), "f");
39
- (0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_injector, (0, createInjector_1.createInjector)({
39
+ tslib_1.__classPrivateFieldSet(this, _PlatformBuilder_adapter, new adapterKlass(this), "f");
40
+ tslib_1.__classPrivateFieldSet(this, _PlatformBuilder_injector, (0, createInjector_1.createInjector)({
40
41
  settings: configuration,
41
- providers: (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").providers
42
+ providers: tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").providers
42
43
  }), "f");
43
44
  this.createHttpServers();
44
- (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").onInit && (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").onInit();
45
+ tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").onInit && tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").onInit();
45
46
  this.log("Injector created...");
46
47
  }
47
48
  get injector() {
48
- return (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f");
49
+ return tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_injector, "f");
49
50
  }
50
51
  get rootModule() {
51
- return (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f").get((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_rootModule, "f"));
52
+ return tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_injector, "f").get(tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_rootModule, "f"));
52
53
  }
53
54
  get app() {
54
55
  return this.injector.get(PlatformApplication_1.PlatformApplication);
@@ -150,8 +151,8 @@ class PlatformBuilder {
150
151
  (0, di_1.setLoggerLevel)(this.injector);
151
152
  await this.importProviders();
152
153
  await this.loadInjector();
153
- (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useContext && (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useContext();
154
- (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useRouter && (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useRouter();
154
+ tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").useContext && tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").useContext();
155
+ tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").useRouter && tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").useRouter();
155
156
  await this.loadRoutes();
156
157
  await this.logRoutes();
157
158
  return this;
@@ -160,7 +161,7 @@ class PlatformBuilder {
160
161
  const { injector } = this;
161
162
  this.log("Build providers");
162
163
  const container = (0, di_1.createContainer)();
163
- container.addProvider((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_rootModule, "f"), {
164
+ container.addProvider(tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_rootModule, "f"), {
164
165
  type: "server:module",
165
166
  scope: di_1.ProviderScope.SINGLETON
166
167
  });
@@ -169,7 +170,7 @@ class PlatformBuilder {
169
170
  await this.callHook("$afterInit");
170
171
  }
171
172
  async listen(network = true) {
172
- if (!(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_promise, "f")) {
173
+ if (!tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_promise, "f")) {
173
174
  await this.bootstrap();
174
175
  }
175
176
  await this.callHook("$beforeListen");
@@ -181,7 +182,10 @@ class PlatformBuilder {
181
182
  }
182
183
  async stop() {
183
184
  await this.callHook("$onDestroy");
184
- return this.injector.destroy();
185
+ await this.injector.destroy();
186
+ tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_listeners, "f").map((server) => {
187
+ return new Promise((resolve) => server.close(() => resolve(undefined)));
188
+ });
185
189
  }
186
190
  async ready() {
187
191
  const { startedAt } = this;
@@ -212,15 +216,15 @@ class PlatformBuilder {
212
216
  return this;
213
217
  }
214
218
  async bootstrap() {
215
- (0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_promise, (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_promise, "f") || this.runLifecycle(), "f");
216
- return (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_promise, "f");
219
+ tslib_1.__classPrivateFieldSet(this, _PlatformBuilder_promise, tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_promise, "f") || this.runLifecycle(), "f");
220
+ return tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_promise, "f");
217
221
  }
218
222
  async loadRoutes() {
219
223
  var _a, _b;
220
- (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").beforeLoadRoutes && (await (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").beforeLoadRoutes());
224
+ tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").beforeLoadRoutes && (await tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").beforeLoadRoutes());
221
225
  // istanbul ignore next
222
226
  if (((_a = this.settings.logger) === null || _a === void 0 ? void 0 : _a.level) !== "off") {
223
- const { PlatformLogMiddleware } = await Promise.resolve().then(() => (0, tslib_1.__importStar)(require("@tsed/platform-log-middleware")));
227
+ const { PlatformLogMiddleware } = await Promise.resolve().then(() => tslib_1.__importStar(require("@tsed/platform-log-middleware")));
224
228
  this.app.use(PlatformLogMiddleware);
225
229
  }
226
230
  if ((_b = this.settings.acceptMimes) === null || _b === void 0 ? void 0 : _b.length) {
@@ -238,7 +242,7 @@ class PlatformBuilder {
238
242
  await this.callHook("$onRoutesInit");
239
243
  await this.loadStatics("$afterRoutesInit");
240
244
  await this.callHook("$afterRoutesInit");
241
- (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").afterLoadRoutes && (await (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").afterLoadRoutes());
245
+ tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").afterLoadRoutes && (await tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_adapter, "f").afterLoadRoutes());
242
246
  }
243
247
  diff() {
244
248
  const ms = di_1.colors.yellow(`+${new Date().getTime() - this.current.getTime()}ms`);
@@ -263,10 +267,10 @@ class PlatformBuilder {
263
267
  });
264
268
  }
265
269
  createHttpServers() {
266
- (0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_servers, [(0, createHttpServer_1.createHttpServer)((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f"), this.callback()), (0, createHttpsServer_1.createHttpsServer)((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f"), this.callback())].filter(Boolean), "f");
270
+ tslib_1.__classPrivateFieldSet(this, _PlatformBuilder_servers, [(0, createHttpServer_1.createHttpServer)(tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_injector, "f"), this.callback()), (0, createHttpsServer_1.createHttpsServer)(tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_injector, "f"), this.callback())].filter(Boolean), "f");
267
271
  }
268
272
  async listenServers() {
269
- await Promise.all((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_servers, "f").map((cb) => cb && cb()));
273
+ tslib_1.__classPrivateFieldSet(this, _PlatformBuilder_listeners, await Promise.all(tslib_1.__classPrivateFieldGet(this, _PlatformBuilder_servers, "f").map((cb) => cb && cb())), "f");
270
274
  }
271
275
  async logRoutes() {
272
276
  var _a;
@@ -278,5 +282,5 @@ class PlatformBuilder {
278
282
  }
279
283
  }
280
284
  exports.PlatformBuilder = PlatformBuilder;
281
- _PlatformBuilder_injector = new WeakMap(), _PlatformBuilder_rootModule = new WeakMap(), _PlatformBuilder_promise = new WeakMap(), _PlatformBuilder_adapter = new WeakMap(), _PlatformBuilder_servers = new WeakMap();
285
+ _PlatformBuilder_injector = new WeakMap(), _PlatformBuilder_rootModule = new WeakMap(), _PlatformBuilder_promise = new WeakMap(), _PlatformBuilder_adapter = new WeakMap(), _PlatformBuilder_servers = new WeakMap(), _PlatformBuilder_listeners = new WeakMap();
282
286
  //# sourceMappingURL=PlatformBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformBuilder.js","sourceRoot":"","sources":["../../../src/builder/PlatformBuilder.ts"],"names":[],"mappings":";;;;;AAAA,qCAAwC;AACxC,iCAA4G;AAC5G,qEAAiE;AACjE,mDAA8C;AAC9C,yEAAoE;AAEpE,kEAA6D;AAE7D,gEAA2D;AAG3D,8DAAyD;AACzD,4DAAuD;AACvD,4FAAuF;AACvF,sDAAiD;AACjD,gEAA2D;AAC3D,kEAA6D;AAE7D;;GAEG;AACH,MAAa,eAAe;IAa1B,YAAsB,OAAuD,EAAE,MAAY,EAAE,QAAqC;QAVzH,SAAI,GAAW,EAAE,CAAC;QACjB,cAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,YAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAE/B,4CAA2B;QAC3B,8CAAuB;QACvB,2CAAwB;QACxB,2CAAuC;QACvC,2CAAkC;QAGhC,oCAAA,IAAI,+BAAe,MAAM,MAAA,CAAC;QAC1B,MAAM,YAAY,GAAG,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC;QACxD,MAAM,IAAI,GAAG,IAAA,aAAM,EAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAExE,MAAM,aAAa,GAAG,IAAA,mCAAgB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;Q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CAAA,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC5E,MAAM,CAAC,IAAI,CAAC,IAAA,yBAAW,EAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;SAC9F;IACH,CAAC;CACF;AAlVD,0CAkVC","sourcesContent":["import {nameOf, Type} from \"@tsed/core\";\nimport {colors, createContainer, InjectorService, IProvider, ProviderScope, setLoggerLevel} from \"@tsed/di\";\nimport {getMiddlewaresForHook} from \"@tsed/platform-middlewares\";\nimport {Platform} from \"../services/Platform\";\nimport {PlatformApplication} from \"../services/PlatformApplication\";\nimport {PlatformStaticsSettings} from \"../config/interfaces/PlatformStaticsSettings\";\nimport {getStaticsOptions} from \"../utils/getStaticsOptions\";\nimport {Route} from \"../interfaces/Route\";\nimport {getConfiguration} from \"../utils/getConfiguration\";\nimport {IncomingMessage, ServerResponse} from \"http\";\nimport {PlatformAdapter, PlatformBuilderSettings} from \"../interfaces/PlatformAdapter\";\nimport {importProviders} from \"../utils/importProviders\";\nimport {createInjector} from \"../utils/createInjector\";\nimport {GlobalAcceptMimesMiddleware} from \"../middlewares/GlobalAcceptMimesMiddleware\";\nimport {printRoutes} from \"../utils/printRoutes\";\nimport {createHttpServer} from \"../utils/createHttpServer\";\nimport {createHttpsServer} from \"../utils/createHttpsServer\";\n\n/**\n * @platform\n */\nexport class PlatformBuilder<App = TsED.Application, Router = TsED.Router> {\n public static adapter: Type<PlatformAdapter>;\n\n readonly name: string = \"\";\n protected startedAt = new Date();\n protected current = new Date();\n\n #injector: InjectorService;\n #rootModule: Type<any>;\n #promise: Promise<this>;\n #adapter: PlatformAdapter<App, Router>;\n #servers: (() => Promise<void>)[];\n\n protected constructor(adapter: Type<PlatformAdapter<App, Router>> | undefined, module: Type, settings: Partial<TsED.Configuration>) {\n this.#rootModule = module;\n const adapterKlass = adapter || PlatformBuilder.adapter;\n const name = nameOf(adapterKlass).replace(\"Platform\", \"\").toLowerCase();\n\n const configuration = getConfiguration(settings, module);\n configuration.PLATFORM_NAME = name;\n this.name = name;\n this.#adapter = new adapterKlass(this);\n\n this.#injector = createInjector({\n settings: configuration,\n providers: this.#adapter.providers\n });\n\n this.createHttpServers();\n\n this.#adapter.onInit && this.#adapter.onInit();\n\n this.log(\"Injector created...\");\n }\n\n get injector(): InjectorService {\n return this.#injector;\n }\n\n get rootModule(): any {\n return this.#injector.get(this.#rootModule);\n }\n\n get app(): PlatformApplication<App, Router> {\n return this.injector.get<PlatformApplication<App, Router>>(PlatformApplication)!;\n }\n\n get platform() {\n return this.injector.get<Platform>(Platform)!;\n }\n\n /**\n * Return the settings configured by the decorator @@Configuration@@.\n *\n * ```typescript\n * @Configuration({\n * rootDir: Path.resolve(__dirname),\n * port: 8000,\n * httpsPort: 8080,\n * mount: {\n * \"/rest\": \"${rootDir}/controllers/**\\/*.js\"\n * }\n * })\n * export class Server {\n * $onInit(){\n * console.log(this.settings); // {rootDir, port, httpsPort,...}\n * }\n * }\n * ```\n *\n * @returns {PlatformConfiguration}\n */\n get settings() {\n return this.injector.settings;\n }\n\n get logger() {\n return this.injector.logger;\n }\n\n get disableBootstrapLog() {\n return this.settings.logger?.disableBootstrapLog;\n }\n\n static create<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>) {\n return this.build(module, {\n httpsPort: false,\n httpPort: false,\n ...settings,\n disableComponentsScan: true\n });\n }\n\n static build<App = TsED.Application, Router = TsED.Router>(\n module: Type<any>,\n {adapter, ...settings}: PlatformBuilderSettings<App, Router>\n ) {\n return new PlatformBuilder(adapter, module, settings);\n }\n\n /**\n * Bootstrap a server application\n * @param module\n * @param settings\n */\n static async bootstrap<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>) {\n return this.build<App, Router>(module, settings).bootstrap();\n }\n\n callback(): (req: IncomingMessage, res: ServerResponse) => void;\n callback(req: IncomingMessage, res: ServerResponse): void;\n callback(req?: IncomingMessage, res?: ServerResponse) {\n if (req && res) {\n return this.app.callback()(req, res);\n }\n\n return this.app.callback();\n }\n\n log(...data: any[]) {\n return !this.disableBootstrapLog && this.logger.info(...data, this.diff());\n }\n\n /**\n * Add classes to the components list\n * @param classes\n */\n public addComponents(classes: any | any[]) {\n this.settings.componentsScan = this.settings.componentsScan.concat(classes);\n\n return this;\n }\n\n /**\n * Add classes decorated by @@Controller@@ to components container.\n *\n * ### Example\n *\n * ```typescript\n * @Controller('/ctrl')\n * class MyController{\n * }\n *\n * platform.addControllers('/rest', [MyController])\n * ```\n *\n * ::: tip\n * If the MyController class isn't decorated, the class will be ignored.\n * :::\n *\n * @param {string} endpoint\n * @param {any[]} controllers\n */\n public addControllers(endpoint: string, controllers: any | string | (any | string)[]) {\n this.settings.mount[endpoint] = (this.settings.mount[endpoint] || []).concat(controllers);\n }\n\n public async runLifecycle() {\n setLoggerLevel(this.injector);\n\n await this.importProviders();\n await this.loadInjector();\n\n this.#adapter.useContext && this.#adapter.useContext();\n this.#adapter.useRouter && this.#adapter.useRouter();\n\n await this.loadRoutes();\n await this.logRoutes();\n\n return this;\n }\n\n async loadInjector() {\n const {injector} = this;\n this.log(\"Build providers\");\n\n const container = createContainer();\n\n container.addProvider(this.#rootModule, {\n type: \"server:module\",\n scope: ProviderScope.SINGLETON\n });\n\n await injector.load(container);\n\n this.log(\"Settings and injector loaded...\");\n\n await this.callHook(\"$afterInit\");\n }\n\n async listen(network = true) {\n if (!this.#promise) {\n await this.bootstrap();\n }\n\n await this.callHook(\"$beforeListen\");\n\n if (network) {\n await this.listenServers();\n }\n\n await this.callHook(\"$afterListen\");\n\n await this.ready();\n }\n\n async stop() {\n await this.callHook(\"$onDestroy\");\n return this.injector.destroy();\n }\n\n public async ready() {\n const {startedAt} = this;\n\n await this.callHook(\"$onReady\");\n await this.injector.emit(\"$onServerReady\");\n\n this.log(`Started in ${new Date().getTime() - startedAt.getTime()} ms`);\n }\n\n async callHook(hook: string, ...args: any[]) {\n const {injector} = this;\n\n if (!this.disableBootstrapLog) {\n injector.logger.debug(`\\x1B[1mCall hook ${hook}\\x1B[22m`);\n }\n\n // Load middlewares for the given hook\n this.loadMiddlewaresFor(hook);\n\n // call hooks added by providers\n await injector.emit(hook, ...args);\n }\n\n async loadStatics(hook: string): Promise<void> {\n const statics = this.settings.get<PlatformStaticsSettings>(\"statics\");\n\n getStaticsOptions(statics).forEach(({path, options}) => {\n if (options.hook === hook) {\n this.platform.app.statics(path, options);\n }\n });\n }\n\n useProvider(token: Type<any>, settings?: Partial<IProvider>) {\n this.injector.addProvider(token, settings);\n\n return this;\n }\n\n async bootstrap() {\n this.#promise = this.#promise || this.runLifecycle();\n\n return this.#promise;\n }\n\n protected async loadRoutes() {\n this.#adapter.beforeLoadRoutes && (await this.#adapter.beforeLoadRoutes());\n\n // istanbul ignore next\n if (this.settings.logger?.level !== \"off\") {\n const {PlatformLogMiddleware} = await import(\"@tsed/platform-log-middleware\");\n this.app.use(PlatformLogMiddleware);\n }\n\n if (this.settings.acceptMimes?.length) {\n this.app.use(GlobalAcceptMimesMiddleware);\n }\n\n this.log(\"Load routes\");\n\n if (this.rootModule.$beforeRoutesInit) {\n await this.rootModule.$beforeRoutesInit();\n this.rootModule.$beforeRoutesInit = () => {};\n }\n\n await this.loadStatics(\"$beforeRoutesInit\");\n await this.callHook(\"$beforeRoutesInit\");\n\n const routes = this.injector.settings.get<Route[]>(\"routes\");\n\n this.platform.addRoutes(routes);\n\n await this.callHook(\"$onRoutesInit\");\n\n await this.loadStatics(\"$afterRoutesInit\");\n\n await this.callHook(\"$afterRoutesInit\");\n\n this.#adapter.afterLoadRoutes && (await this.#adapter.afterLoadRoutes());\n }\n\n protected diff() {\n const ms = colors.yellow(`+${new Date().getTime() - this.current.getTime()}ms`);\n this.current = new Date();\n return ms;\n }\n\n protected async importProviders() {\n this.injector.logger.debug(\"Scan components\");\n\n const providers = await importProviders(this.injector.settings, [\"imports\", \"mount\", \"componentsScan\"]);\n const routes = providers.filter((provider) => !!provider.route).map(({route, token}) => ({route, token}));\n\n this.settings.set(\"routes\", routes);\n this.log(\"Providers loaded...\");\n }\n\n /**\n * Load middlewares from configuration for the given hook\n * @param hook\n * @protected\n */\n protected loadMiddlewaresFor(hook: string): void {\n return getMiddlewaresForHook(hook, this.settings, \"$beforeRoutesInit\").forEach(({use}) => {\n this.app.use(use);\n });\n }\n\n protected createHttpServers() {\n this.#servers = [createHttpServer(this.#injector, this.callback()), createHttpsServer(this.#injector, this.callback())].filter(\n Boolean\n ) as any[];\n }\n\n protected async listenServers(): Promise<void> {\n await Promise.all(this.#servers.map((cb) => cb && cb()));\n }\n\n protected async logRoutes() {\n const {logger, platform} = this;\n\n this.log(\"Routes mounted...\");\n\n if (!this.settings.logger?.disableRoutesSummary && !this.disableBootstrapLog) {\n logger.info(printRoutes(await this.injector.alterAsync(\"$logRoutes\", platform.getRoutes())));\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformBuilder.js","sourceRoot":"","sources":["../../../src/builder/PlatformBuilder.ts"],"names":[],"mappings":";;;;;AAAA,qCAAwC;AACxC,iCAA4G;AAC5G,qEAAiE;AACjE,mDAA8C;AAC9C,yEAAoE;AAEpE,kEAA6D;AAE7D,gEAA2D;AAG3D,8DAAyD;AACzD,4DAAuD;AACvD,4FAAuF;AACvF,sDAAiD;AACjD,gEAA2D;AAC3D,kEAA6D;AAG7D;;GAEG;AACH,MAAa,eAAe;IAc1B,YAAsB,OAAuD,EAAE,MAAY,EAAE,QAAqC;QAXzH,SAAI,GAAW,EAAE,CAAC;QACjB,cAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,YAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAE/B,4CAA2B;QAC3B,8CAAuB;QACvB,2CAAwB;QACxB,2CAAuC;QACvC,2CAAmD;QACnD,qCAAwC,EAAE,EAAC;QAGzC,+BAAA,IAAI,+BAAe,MAAM,MAAA,CAAC;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U,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAC5H,OAAO,CACC,MAAA,CAAC;IACb,CAAC;IAES,KAAK,CAAC,aAAa;QAC3B,+BAAA,IAAI,8BAAc,MAAM,OAAO,CAAC,GAAG,CAAC,+BAAA,IAAI,gCAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAA,CAAC;IAC7E,CAAC;IAES,KAAK,CAAC,SAAS;;QACvB,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;QAEhC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAE9B,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,0CAAE,oBAAoB,CAAA,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC5E,MAAM,CAAC,IAAI,CAAC,IAAA,yBAAW,EAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;SAC9F;IACH,CAAC;CACF;AAvVD,0CAuVC","sourcesContent":["import {nameOf, Type} from \"@tsed/core\";\nimport {colors, createContainer, InjectorService, IProvider, ProviderScope, setLoggerLevel} from \"@tsed/di\";\nimport {getMiddlewaresForHook} from \"@tsed/platform-middlewares\";\nimport {Platform} from \"../services/Platform\";\nimport {PlatformApplication} from \"../services/PlatformApplication\";\nimport {PlatformStaticsSettings} from \"../config/interfaces/PlatformStaticsSettings\";\nimport {getStaticsOptions} from \"../utils/getStaticsOptions\";\nimport {Route} from \"../interfaces/Route\";\nimport {getConfiguration} from \"../utils/getConfiguration\";\nimport type {IncomingMessage, ServerResponse, Server} from \"http\";\nimport {PlatformAdapter, PlatformBuilderSettings} from \"../interfaces/PlatformAdapter\";\nimport {importProviders} from \"../utils/importProviders\";\nimport {createInjector} from \"../utils/createInjector\";\nimport {GlobalAcceptMimesMiddleware} from \"../middlewares/GlobalAcceptMimesMiddleware\";\nimport {printRoutes} from \"../utils/printRoutes\";\nimport {createHttpServer} from \"../utils/createHttpServer\";\nimport {createHttpsServer} from \"../utils/createHttpsServer\";\nimport type Https from \"https\";\n\n/**\n * @platform\n */\nexport class PlatformBuilder<App = TsED.Application, Router = TsED.Router> {\n public static adapter: Type<PlatformAdapter>;\n\n readonly name: string = \"\";\n protected startedAt = new Date();\n protected current = new Date();\n\n #injector: InjectorService;\n #rootModule: Type<any>;\n #promise: Promise<this>;\n #adapter: PlatformAdapter<App, Router>;\n #servers: (() => Promise<Server | Https.Server>)[];\n #listeners: (Server | Https.Server)[] = [];\n\n protected constructor(adapter: Type<PlatformAdapter<App, Router>> | undefined, module: Type, settings: Partial<TsED.Configuration>) {\n this.#rootModule = module;\n const adapterKlass = adapter || PlatformBuilder.adapter;\n const name = nameOf(adapterKlass).replace(\"Platform\", \"\").toLowerCase();\n\n const configuration = getConfiguration(settings, module);\n configuration.PLATFORM_NAME = name;\n this.name = name;\n this.#adapter = new adapterKlass(this);\n\n this.#injector = createInjector({\n settings: configuration,\n providers: this.#adapter.providers\n });\n\n this.createHttpServers();\n\n this.#adapter.onInit && this.#adapter.onInit();\n\n this.log(\"Injector created...\");\n }\n\n get injector(): InjectorService {\n return this.#injector;\n }\n\n get rootModule(): any {\n return this.#injector.get(this.#rootModule);\n }\n\n get app(): PlatformApplication<App, Router> {\n return this.injector.get<PlatformApplication<App, Router>>(PlatformApplication)!;\n }\n\n get platform() {\n return this.injector.get<Platform>(Platform)!;\n }\n\n /**\n * Return the settings configured by the decorator @@Configuration@@.\n *\n * ```typescript\n * @Configuration({\n * rootDir: Path.resolve(__dirname),\n * port: 8000,\n * httpsPort: 8080,\n * mount: {\n * \"/rest\": \"${rootDir}/controllers/**\\/*.js\"\n * }\n * })\n * export class Server {\n * $onInit(){\n * console.log(this.settings); // {rootDir, port, httpsPort,...}\n * }\n * }\n * ```\n *\n * @returns {PlatformConfiguration}\n */\n get settings() {\n return this.injector.settings;\n }\n\n get logger() {\n return this.injector.logger;\n }\n\n get disableBootstrapLog() {\n return this.settings.logger?.disableBootstrapLog;\n }\n\n static create<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>) {\n return this.build(module, {\n httpsPort: false,\n httpPort: false,\n ...settings,\n disableComponentsScan: true\n });\n }\n\n static build<App = TsED.Application, Router = TsED.Router>(\n module: Type<any>,\n {adapter, ...settings}: PlatformBuilderSettings<App, Router>\n ) {\n return new PlatformBuilder(adapter, module, settings);\n }\n\n /**\n * Bootstrap a server application\n * @param module\n * @param settings\n */\n static async bootstrap<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>) {\n return this.build<App, Router>(module, settings).bootstrap();\n }\n\n callback(): (req: IncomingMessage, res: ServerResponse) => void;\n callback(req: IncomingMessage, res: ServerResponse): void;\n callback(req?: IncomingMessage, res?: ServerResponse) {\n if (req && res) {\n return this.app.callback()(req, res);\n }\n\n return this.app.callback();\n }\n\n log(...data: any[]) {\n return !this.disableBootstrapLog && this.logger.info(...data, this.diff());\n }\n\n /**\n * Add classes to the components list\n * @param classes\n */\n public addComponents(classes: any | any[]) {\n this.settings.componentsScan = this.settings.componentsScan.concat(classes);\n\n return this;\n }\n\n /**\n * Add classes decorated by @@Controller@@ to components container.\n *\n * ### Example\n *\n * ```typescript\n * @Controller('/ctrl')\n * class MyController{\n * }\n *\n * platform.addControllers('/rest', [MyController])\n * ```\n *\n * ::: tip\n * If the MyController class isn't decorated, the class will be ignored.\n * :::\n *\n * @param {string} endpoint\n * @param {any[]} controllers\n */\n public addControllers(endpoint: string, controllers: any | string | (any | string)[]) {\n this.settings.mount[endpoint] = (this.settings.mount[endpoint] || []).concat(controllers);\n }\n\n public async runLifecycle() {\n setLoggerLevel(this.injector);\n\n await this.importProviders();\n await this.loadInjector();\n\n this.#adapter.useContext && this.#adapter.useContext();\n this.#adapter.useRouter && this.#adapter.useRouter();\n\n await this.loadRoutes();\n await this.logRoutes();\n\n return this;\n }\n\n async loadInjector() {\n const {injector} = this;\n this.log(\"Build providers\");\n\n const container = createContainer();\n\n container.addProvider(this.#rootModule, {\n type: \"server:module\",\n scope: ProviderScope.SINGLETON\n });\n\n await injector.load(container);\n\n this.log(\"Settings and injector loaded...\");\n\n await this.callHook(\"$afterInit\");\n }\n\n async listen(network = true) {\n if (!this.#promise) {\n await this.bootstrap();\n }\n\n await this.callHook(\"$beforeListen\");\n\n if (network) {\n await this.listenServers();\n }\n\n await this.callHook(\"$afterListen\");\n\n await this.ready();\n }\n\n async stop() {\n await this.callHook(\"$onDestroy\");\n await this.injector.destroy();\n\n this.#listeners.map((server) => {\n return new Promise((resolve) => server.close(() => resolve(undefined)));\n });\n }\n\n public async ready() {\n const {startedAt} = this;\n\n await this.callHook(\"$onReady\");\n await this.injector.emit(\"$onServerReady\");\n\n this.log(`Started in ${new Date().getTime() - startedAt.getTime()} ms`);\n }\n\n async callHook(hook: string, ...args: any[]) {\n const {injector} = this;\n\n if (!this.disableBootstrapLog) {\n injector.logger.debug(`\\x1B[1mCall hook ${hook}\\x1B[22m`);\n }\n\n // Load middlewares for the given hook\n this.loadMiddlewaresFor(hook);\n\n // call hooks added by providers\n await injector.emit(hook, ...args);\n }\n\n async loadStatics(hook: string): Promise<void> {\n const statics = this.settings.get<PlatformStaticsSettings>(\"statics\");\n\n getStaticsOptions(statics).forEach(({path, options}) => {\n if (options.hook === hook) {\n this.platform.app.statics(path, options);\n }\n });\n }\n\n useProvider(token: Type<any>, settings?: Partial<IProvider>) {\n this.injector.addProvider(token, settings);\n\n return this;\n }\n\n async bootstrap() {\n this.#promise = this.#promise || this.runLifecycle();\n\n return this.#promise;\n }\n\n protected async loadRoutes() {\n this.#adapter.beforeLoadRoutes && (await this.#adapter.beforeLoadRoutes());\n\n // istanbul ignore next\n if (this.settings.logger?.level !== \"off\") {\n const {PlatformLogMiddleware} = await import(\"@tsed/platform-log-middleware\");\n this.app.use(PlatformLogMiddleware);\n }\n\n if (this.settings.acceptMimes?.length) {\n this.app.use(GlobalAcceptMimesMiddleware);\n }\n\n this.log(\"Load routes\");\n\n if (this.rootModule.$beforeRoutesInit) {\n await this.rootModule.$beforeRoutesInit();\n this.rootModule.$beforeRoutesInit = () => {};\n }\n\n await this.loadStatics(\"$beforeRoutesInit\");\n await this.callHook(\"$beforeRoutesInit\");\n\n const routes = this.injector.settings.get<Route[]>(\"routes\");\n\n this.platform.addRoutes(routes);\n\n await this.callHook(\"$onRoutesInit\");\n\n await this.loadStatics(\"$afterRoutesInit\");\n\n await this.callHook(\"$afterRoutesInit\");\n\n this.#adapter.afterLoadRoutes && (await this.#adapter.afterLoadRoutes());\n }\n\n protected diff() {\n const ms = colors.yellow(`+${new Date().getTime() - this.current.getTime()}ms`);\n this.current = new Date();\n return ms;\n }\n\n protected async importProviders() {\n this.injector.logger.debug(\"Scan components\");\n\n const providers = await importProviders(this.injector.settings, [\"imports\", \"mount\", \"componentsScan\"]);\n const routes = providers.filter((provider) => !!provider.route).map(({route, token}) => ({route, token}));\n\n this.settings.set(\"routes\", routes);\n this.log(\"Providers loaded...\");\n }\n\n /**\n * Load middlewares from configuration for the given hook\n * @param hook\n * @protected\n */\n protected loadMiddlewaresFor(hook: string): void {\n return getMiddlewaresForHook(hook, this.settings, \"$beforeRoutesInit\").forEach(({use}) => {\n this.app.use(use);\n });\n }\n\n protected createHttpServers() {\n this.#servers = [createHttpServer(this.#injector, this.callback()), createHttpsServer(this.#injector, this.callback())].filter(\n Boolean\n ) as any[];\n }\n\n protected async listenServers(): Promise<void> {\n this.#listeners = await Promise.all(this.#servers.map((cb) => cb && cb()));\n }\n\n protected async logRoutes() {\n const {logger, platform} = this;\n\n this.log(\"Routes mounted...\");\n\n if (!this.settings.logger?.disableRoutesSummary && !this.disableBootstrapLog) {\n logger.info(printRoutes(await this.injector.alterAsync(\"$logRoutes\", platform.getRoutes())));\n }\n }\n}\n"]}
@@ -167,12 +167,12 @@ let PlatformConfiguration = class PlatformConfiguration extends di_1.DIConfigura
167
167
  };
168
168
  }
169
169
  };
170
- PlatformConfiguration = (0, tslib_1.__decorate)([
170
+ PlatformConfiguration = tslib_1.__decorate([
171
171
  (0, di_1.Injectable)({
172
172
  scope: di_1.ProviderScope.SINGLETON,
173
173
  global: true
174
174
  }),
175
- (0, tslib_1.__metadata)("design:paramtypes", [])
175
+ tslib_1.__metadata("design:paramtypes", [])
176
176
  ], PlatformConfiguration);
177
177
  exports.PlatformConfiguration = PlatformConfiguration;
178
178
  //# sourceMappingURL=PlatformConfiguration.js.map
@@ -4,14 +4,14 @@ exports.All = exports.Options = exports.Head = exports.Delete = exports.Patch =
4
4
  const tslib_1 = require("tslib");
5
5
  require("@tsed/logger");
6
6
  require("@tsed/logger-file");
7
- (0, tslib_1.__exportStar)(require("@tsed/di"), exports);
8
- (0, tslib_1.__exportStar)(require("@tsed/platform-params"), exports);
9
- (0, tslib_1.__exportStar)(require("@tsed/platform-exceptions"), exports);
10
- (0, tslib_1.__exportStar)(require("@tsed/platform-response-filter"), exports);
11
- (0, tslib_1.__exportStar)(require("@tsed/platform-cache"), exports);
12
- (0, tslib_1.__exportStar)(require("@tsed/platform-middlewares"), exports);
13
- (0, tslib_1.__exportStar)(require("@tsed/components-scan"), exports);
14
- (0, tslib_1.__exportStar)(require("@tsed/platform-log-middleware"), exports);
7
+ tslib_1.__exportStar(require("@tsed/di"), exports);
8
+ tslib_1.__exportStar(require("@tsed/platform-params"), exports);
9
+ tslib_1.__exportStar(require("@tsed/platform-exceptions"), exports);
10
+ tslib_1.__exportStar(require("@tsed/platform-response-filter"), exports);
11
+ tslib_1.__exportStar(require("@tsed/platform-cache"), exports);
12
+ tslib_1.__exportStar(require("@tsed/platform-middlewares"), exports);
13
+ tslib_1.__exportStar(require("@tsed/components-scan"), exports);
14
+ tslib_1.__exportStar(require("@tsed/platform-log-middleware"), exports);
15
15
  var logger_1 = require("@tsed/logger");
16
16
  Object.defineProperty(exports, "$log", { enumerable: true, get: function () { return logger_1.$log; } });
17
17
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
@@ -1 +1 @@
1
- {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":";;;;AAAA,wBAAsB;AACtB,6BAA2B;AAE3B,wDAAyB;AACzB,qEAAsC;AACtC,yEAA0C;AAC1C,8EAA+C;AAC/C,oEAAqC;AACrC,0EAA2C;AAC3C,qEAAsC;AACtC,6EAA8C;AAE9C,uCAA0C;AAAlC,8FAAA,IAAI,OAAA;AAAE,gGAAA,MAAM,OAAA;AAEpB,uCAAqH;AAA7G,oGAAA,UAAU,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,6FAAA,GAAG,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,6FAAA,GAAG,OAAA;AAAE,+FAAA,KAAK,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,6FAAA,GAAG,OAAA","sourcesContent":["import \"@tsed/logger\";\nimport \"@tsed/logger-file\";\n\nexport * from \"@tsed/di\";\nexport * from \"@tsed/platform-params\";\nexport * from \"@tsed/platform-exceptions\";\nexport * from \"@tsed/platform-response-filter\";\nexport * from \"@tsed/platform-cache\";\nexport * from \"@tsed/platform-middlewares\";\nexport * from \"@tsed/components-scan\";\nexport * from \"@tsed/platform-log-middleware\";\n\nexport {$log, Logger} from \"@tsed/logger\";\n\nexport {AcceptMime, Location, Redirect, View, Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\n"]}
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":";;;;AAAA,wBAAsB;AACtB,6BAA2B;AAE3B,mDAAyB;AACzB,gEAAsC;AACtC,oEAA0C;AAC1C,yEAA+C;AAC/C,+DAAqC;AACrC,qEAA2C;AAC3C,gEAAsC;AACtC,wEAA8C;AAE9C,uCAA0C;AAAlC,8FAAA,IAAI,OAAA;AAAE,gGAAA,MAAM,OAAA;AAEpB,uCAAqH;AAA7G,oGAAA,UAAU,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,6FAAA,GAAG,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,6FAAA,GAAG,OAAA;AAAE,+FAAA,KAAK,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,6FAAA,GAAG,OAAA","sourcesContent":["import \"@tsed/logger\";\nimport \"@tsed/logger-file\";\n\nexport * from \"@tsed/di\";\nexport * from \"@tsed/platform-params\";\nexport * from \"@tsed/platform-exceptions\";\nexport * from \"@tsed/platform-response-filter\";\nexport * from \"@tsed/platform-cache\";\nexport * from \"@tsed/platform-middlewares\";\nexport * from \"@tsed/components-scan\";\nexport * from \"@tsed/platform-log-middleware\";\n\nexport {$log, Logger} from \"@tsed/logger\";\n\nexport {AcceptMime, Location, Redirect, View, Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\n"]}
package/lib/cjs/index.js CHANGED
@@ -4,77 +4,77 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const tslib_1 = require("tslib");
7
- (0, tslib_1.__exportStar)(require("./PlatformModule"), exports);
8
- (0, tslib_1.__exportStar)(require("./exports"), exports);
9
- (0, tslib_1.__exportStar)(require("./builder/PlatformBuilder"), exports);
10
- (0, tslib_1.__exportStar)(require("./builder/PlatformControllerBuilder"), exports);
11
- (0, tslib_1.__exportStar)(require("./config/interfaces/ConverterSettings"), exports);
12
- (0, tslib_1.__exportStar)(require("./config/interfaces/EndpointDirectoriesSettings"), exports);
13
- (0, tslib_1.__exportStar)(require("./config/interfaces/PlatformLoggerSettings"), exports);
14
- (0, tslib_1.__exportStar)(require("./config/interfaces/PlatformMulterSettings"), exports);
15
- (0, tslib_1.__exportStar)(require("./config/interfaces/PlatformStaticsSettings"), exports);
16
- (0, tslib_1.__exportStar)(require("./config/services/PlatformConfiguration"), exports);
17
- (0, tslib_1.__exportStar)(require("./constants/routerOptions"), exports);
18
- (0, tslib_1.__exportStar)(require("./decorators/httpServer"), exports);
19
- (0, tslib_1.__exportStar)(require("./decorators/httpsServer"), exports);
20
- (0, tslib_1.__exportStar)(require("./decorators/method/endpointFn"), exports);
21
- (0, tslib_1.__exportStar)(require("./decorators/multer/multerFileSize"), exports);
22
- (0, tslib_1.__exportStar)(require("./decorators/multer/multerOptions"), exports);
23
- (0, tslib_1.__exportStar)(require("./decorators/multer/multipartFile"), exports);
24
- (0, tslib_1.__exportStar)(require("./decorators/params/endpointInfo"), exports);
25
- (0, tslib_1.__exportStar)(require("./decorators/params/error"), exports);
26
- (0, tslib_1.__exportStar)(require("./decorators/params/next"), exports);
27
- (0, tslib_1.__exportStar)(require("./decorators/params/request"), exports);
28
- (0, tslib_1.__exportStar)(require("./decorators/params/response"), exports);
29
- (0, tslib_1.__exportStar)(require("./decorators/params/responseData"), exports);
30
- (0, tslib_1.__exportStar)(require("./domain/AnyToPromiseWithCtx"), exports);
31
- (0, tslib_1.__exportStar)(require("./domain/ControllerProvider"), exports);
32
- (0, tslib_1.__exportStar)(require("./domain/EndpointMetadata"), exports);
33
- (0, tslib_1.__exportStar)(require("./domain/HandlerMetadata"), exports);
34
- (0, tslib_1.__exportStar)(require("./domain/PlatformContext"), exports);
35
- (0, tslib_1.__exportStar)(require("./domain/PlatformRouteDetails"), exports);
36
- (0, tslib_1.__exportStar)(require("./domain/PropertyMetadata"), exports);
37
- (0, tslib_1.__exportStar)(require("./interfaces/AfterInit"), exports);
38
- (0, tslib_1.__exportStar)(require("./interfaces/AfterListen"), exports);
39
- (0, tslib_1.__exportStar)(require("./interfaces/AfterRoutesInit"), exports);
40
- (0, tslib_1.__exportStar)(require("./interfaces/BeforeInit"), exports);
41
- (0, tslib_1.__exportStar)(require("./interfaces/BeforeListen"), exports);
42
- (0, tslib_1.__exportStar)(require("./interfaces/BeforeRoutesInit"), exports);
43
- (0, tslib_1.__exportStar)(require("./interfaces/HandlerType"), exports);
44
- (0, tslib_1.__exportStar)(require("./interfaces/IncomingEvent"), exports);
45
- (0, tslib_1.__exportStar)(require("./interfaces/OnReady"), exports);
46
- (0, tslib_1.__exportStar)(require("./interfaces/OnRequest"), exports);
47
- (0, tslib_1.__exportStar)(require("./interfaces/OnResponse"), exports);
48
- (0, tslib_1.__exportStar)(require("./interfaces/OnRoutesInit"), exports);
49
- (0, tslib_1.__exportStar)(require("./interfaces/PlatformAdapter"), exports);
50
- (0, tslib_1.__exportStar)(require("./interfaces/PlatformRouteOptions"), exports);
51
- (0, tslib_1.__exportStar)(require("./interfaces/ResponseErrorObject"), exports);
52
- (0, tslib_1.__exportStar)(require("./interfaces/Route"), exports);
53
- (0, tslib_1.__exportStar)(require("./middlewares/AcceptMimesMiddleware"), exports);
54
- (0, tslib_1.__exportStar)(require("./middlewares/GlobalAcceptMimesMiddleware"), exports);
55
- (0, tslib_1.__exportStar)(require("./middlewares/PlatformAcceptMimesMiddleware"), exports);
56
- (0, tslib_1.__exportStar)(require("./middlewares/PlatformMulterMiddleware"), exports);
57
- (0, tslib_1.__exportStar)(require("./middlewares/bindEndpointMiddleware"), exports);
58
- (0, tslib_1.__exportStar)(require("./services/FakeRawDriver"), exports);
59
- (0, tslib_1.__exportStar)(require("./services/Platform"), exports);
60
- (0, tslib_1.__exportStar)(require("./services/PlatformApplication"), exports);
61
- (0, tslib_1.__exportStar)(require("./services/PlatformHandler"), exports);
62
- (0, tslib_1.__exportStar)(require("./services/PlatformMiddlewaresChain"), exports);
63
- (0, tslib_1.__exportStar)(require("./services/PlatformRequest"), exports);
64
- (0, tslib_1.__exportStar)(require("./services/PlatformResponse"), exports);
65
- (0, tslib_1.__exportStar)(require("./services/PlatformRouter"), exports);
66
- (0, tslib_1.__exportStar)(require("./services/PlatformTest"), exports);
67
- (0, tslib_1.__exportStar)(require("./utils/createContext"), exports);
68
- (0, tslib_1.__exportStar)(require("./utils/createHandlerMetadata"), exports);
69
- (0, tslib_1.__exportStar)(require("./utils/createHttpServer"), exports);
70
- (0, tslib_1.__exportStar)(require("./utils/createHttpsServer"), exports);
71
- (0, tslib_1.__exportStar)(require("./utils/createInjector"), exports);
72
- (0, tslib_1.__exportStar)(require("./utils/getStaticsOptions"), exports);
73
- (0, tslib_1.__exportStar)(require("./utils/importProviders"), exports);
74
- (0, tslib_1.__exportStar)(require("./utils/listenServer"), exports);
75
- (0, tslib_1.__exportStar)(require("./utils/loadInjector"), exports);
76
- (0, tslib_1.__exportStar)(require("./utils/mapReturnedResponse"), exports);
77
- (0, tslib_1.__exportStar)(require("./utils/printRoutes"), exports);
78
- (0, tslib_1.__exportStar)(require("./utils/setResponseHeaders"), exports);
79
- (0, tslib_1.__exportStar)(require("./utils/useCtxHandler"), exports);
7
+ tslib_1.__exportStar(require("./PlatformModule"), exports);
8
+ tslib_1.__exportStar(require("./exports"), exports);
9
+ tslib_1.__exportStar(require("./builder/PlatformBuilder"), exports);
10
+ tslib_1.__exportStar(require("./builder/PlatformControllerBuilder"), exports);
11
+ tslib_1.__exportStar(require("./config/interfaces/ConverterSettings"), exports);
12
+ tslib_1.__exportStar(require("./config/interfaces/EndpointDirectoriesSettings"), exports);
13
+ tslib_1.__exportStar(require("./config/interfaces/PlatformLoggerSettings"), exports);
14
+ tslib_1.__exportStar(require("./config/interfaces/PlatformMulterSettings"), exports);
15
+ tslib_1.__exportStar(require("./config/interfaces/PlatformStaticsSettings"), exports);
16
+ tslib_1.__exportStar(require("./config/services/PlatformConfiguration"), exports);
17
+ tslib_1.__exportStar(require("./constants/routerOptions"), exports);
18
+ tslib_1.__exportStar(require("./decorators/httpServer"), exports);
19
+ tslib_1.__exportStar(require("./decorators/httpsServer"), exports);
20
+ tslib_1.__exportStar(require("./decorators/method/endpointFn"), exports);
21
+ tslib_1.__exportStar(require("./decorators/multer/multerFileSize"), exports);
22
+ tslib_1.__exportStar(require("./decorators/multer/multerOptions"), exports);
23
+ tslib_1.__exportStar(require("./decorators/multer/multipartFile"), exports);
24
+ tslib_1.__exportStar(require("./decorators/params/endpointInfo"), exports);
25
+ tslib_1.__exportStar(require("./decorators/params/error"), exports);
26
+ tslib_1.__exportStar(require("./decorators/params/next"), exports);
27
+ tslib_1.__exportStar(require("./decorators/params/request"), exports);
28
+ tslib_1.__exportStar(require("./decorators/params/response"), exports);
29
+ tslib_1.__exportStar(require("./decorators/params/responseData"), exports);
30
+ tslib_1.__exportStar(require("./domain/AnyToPromiseWithCtx"), exports);
31
+ tslib_1.__exportStar(require("./domain/ControllerProvider"), exports);
32
+ tslib_1.__exportStar(require("./domain/EndpointMetadata"), exports);
33
+ tslib_1.__exportStar(require("./domain/HandlerMetadata"), exports);
34
+ tslib_1.__exportStar(require("./domain/PlatformContext"), exports);
35
+ tslib_1.__exportStar(require("./domain/PlatformRouteDetails"), exports);
36
+ tslib_1.__exportStar(require("./domain/PropertyMetadata"), exports);
37
+ tslib_1.__exportStar(require("./interfaces/AfterInit"), exports);
38
+ tslib_1.__exportStar(require("./interfaces/AfterListen"), exports);
39
+ tslib_1.__exportStar(require("./interfaces/AfterRoutesInit"), exports);
40
+ tslib_1.__exportStar(require("./interfaces/BeforeInit"), exports);
41
+ tslib_1.__exportStar(require("./interfaces/BeforeListen"), exports);
42
+ tslib_1.__exportStar(require("./interfaces/BeforeRoutesInit"), exports);
43
+ tslib_1.__exportStar(require("./interfaces/HandlerType"), exports);
44
+ tslib_1.__exportStar(require("./interfaces/IncomingEvent"), exports);
45
+ tslib_1.__exportStar(require("./interfaces/OnReady"), exports);
46
+ tslib_1.__exportStar(require("./interfaces/OnRequest"), exports);
47
+ tslib_1.__exportStar(require("./interfaces/OnResponse"), exports);
48
+ tslib_1.__exportStar(require("./interfaces/OnRoutesInit"), exports);
49
+ tslib_1.__exportStar(require("./interfaces/PlatformAdapter"), exports);
50
+ tslib_1.__exportStar(require("./interfaces/PlatformRouteOptions"), exports);
51
+ tslib_1.__exportStar(require("./interfaces/ResponseErrorObject"), exports);
52
+ tslib_1.__exportStar(require("./interfaces/Route"), exports);
53
+ tslib_1.__exportStar(require("./middlewares/AcceptMimesMiddleware"), exports);
54
+ tslib_1.__exportStar(require("./middlewares/GlobalAcceptMimesMiddleware"), exports);
55
+ tslib_1.__exportStar(require("./middlewares/PlatformAcceptMimesMiddleware"), exports);
56
+ tslib_1.__exportStar(require("./middlewares/PlatformMulterMiddleware"), exports);
57
+ tslib_1.__exportStar(require("./middlewares/bindEndpointMiddleware"), exports);
58
+ tslib_1.__exportStar(require("./services/FakeRawDriver"), exports);
59
+ tslib_1.__exportStar(require("./services/Platform"), exports);
60
+ tslib_1.__exportStar(require("./services/PlatformApplication"), exports);
61
+ tslib_1.__exportStar(require("./services/PlatformHandler"), exports);
62
+ tslib_1.__exportStar(require("./services/PlatformMiddlewaresChain"), exports);
63
+ tslib_1.__exportStar(require("./services/PlatformRequest"), exports);
64
+ tslib_1.__exportStar(require("./services/PlatformResponse"), exports);
65
+ tslib_1.__exportStar(require("./services/PlatformRouter"), exports);
66
+ tslib_1.__exportStar(require("./services/PlatformTest"), exports);
67
+ tslib_1.__exportStar(require("./utils/createContext"), exports);
68
+ tslib_1.__exportStar(require("./utils/createHandlerMetadata"), exports);
69
+ tslib_1.__exportStar(require("./utils/createHttpServer"), exports);
70
+ tslib_1.__exportStar(require("./utils/createHttpsServer"), exports);
71
+ tslib_1.__exportStar(require("./utils/createInjector"), exports);
72
+ tslib_1.__exportStar(require("./utils/getStaticsOptions"), exports);
73
+ tslib_1.__exportStar(require("./utils/importProviders"), exports);
74
+ tslib_1.__exportStar(require("./utils/listenServer"), exports);
75
+ tslib_1.__exportStar(require("./utils/loadInjector"), exports);
76
+ tslib_1.__exportStar(require("./utils/mapReturnedResponse"), exports);
77
+ tslib_1.__exportStar(require("./utils/printRoutes"), exports);
78
+ tslib_1.__exportStar(require("./utils/setResponseHeaders"), exports);
79
+ tslib_1.__exportStar(require("./utils/useCtxHandler"), exports);
80
80
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gEAAiC;AACjC,yDAA0B;AAC1B,yEAA0C;AAC1C,mFAAoD;AACpD,qFAAsD;AACtD,+FAAgE;AAChE,0FAA2D;AAC3D,0FAA2D;AAC3D,2FAA4D;AAC5D,uFAAwD;AACxD,yEAA0C;AAC1C,uEAAwC;AACxC,wEAAyC;AACzC,8EAA+C;AAC/C,kFAAmD;AACnD,iFAAkD;AAClD,iFAAkD;AAClD,gFAAiD;AACjD,yEAA0C;AAC1C,wEAAyC;AACzC,2EAA4C;AAC5C,4EAA6C;AAC7C,gFAAiD;AACjD,4EAA6C;AAC7C,2EAA4C;AAC5C,yEAA0C;AAC1C,wEAAyC;AACzC,wEAAyC;AACzC,6EAA8C;AAC9C,yEAA0C;AAC1C,sEAAuC;AACvC,wEAAyC;AACzC,4EAA6C;AAC7C,uEAAwC;AACxC,yEAA0C;AAC1C,6EAA8C;AAC9C,wEAAyC;AACzC,0EAA2C;AAC3C,oEAAqC;AACrC,sEAAuC;AACvC,uEAAwC;AACxC,yEAA0C;AAC1C,4EAA6C;AAC7C,iFAAkD;AAClD,gFAAiD;AACjD,kEAAmC;AACnC,mFAAoD;AACpD,yFAA0D;AAC1D,2FAA4D;AAC5D,sFAAuD;AACvD,oFAAqD;AACrD,wEAAyC;AACzC,mEAAoC;AACpC,8EAA+C;AAC/C,0EAA2C;AAC3C,mFAAoD;AACpD,0EAA2C;AAC3C,2EAA4C;AAC5C,yEAA0C;AAC1C,uEAAwC;AACxC,qEAAsC;AACtC,6EAA8C;AAC9C,wEAAyC;AACzC,yEAA0C;AAC1C,sEAAuC;AACvC,yEAA0C;AAC1C,uEAAwC;AACxC,oEAAqC;AACrC,oEAAqC;AACrC,2EAA4C;AAC5C,mEAAoC;AACpC,0EAA2C;AAC3C,qEAAsC","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/EndpointDirectoriesSettings\";\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/PlatformAdapter\";\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/FakeRawDriver\";\nexport * from \"./services/Platform\";\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/importProviders\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/loadInjector\";\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,gFAAsD;AACtD,0FAAgE;AAChE,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,uEAA6C;AAC7C,4EAAkD;AAClD,2EAAiD;AACjD,6DAAmC;AACnC,8EAAoD;AACpD,oFAA0D;AAC1D,sFAA4D;AAC5D,iFAAuD;AACvD,+EAAqD;AACrD,mEAAyC;AACzC,8DAAoC;AACpC,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,kEAAwC;AACxC,+DAAqC;AACrC,+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/EndpointDirectoriesSettings\";\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/PlatformAdapter\";\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/FakeRawDriver\";\nexport * from \"./services/Platform\";\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/importProviders\";\nexport * from \"./utils/listenServer\";\nexport * from \"./utils/loadInjector\";\nexport * from \"./utils/mapReturnedResponse\";\nexport * from \"./utils/printRoutes\";\nexport * from \"./utils/setResponseHeaders\";\nexport * from \"./utils/useCtxHandler\";\n"]}
@@ -14,13 +14,13 @@ let AcceptMimesMiddleware = class AcceptMimesMiddleware {
14
14
  return;
15
15
  }
16
16
  };
17
- (0, tslib_1.__decorate)([
18
- (0, tslib_1.__param)(0, (0, platform_params_1.Context)()),
19
- (0, tslib_1.__metadata)("design:type", Function),
20
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
21
- (0, tslib_1.__metadata)("design:returntype", void 0)
17
+ tslib_1.__decorate([
18
+ tslib_1.__param(0, (0, platform_params_1.Context)()),
19
+ tslib_1.__metadata("design:type", Function),
20
+ tslib_1.__metadata("design:paramtypes", [Object]),
21
+ tslib_1.__metadata("design:returntype", void 0)
22
22
  ], AcceptMimesMiddleware.prototype, "use", null);
23
- AcceptMimesMiddleware = (0, tslib_1.__decorate)([
23
+ AcceptMimesMiddleware = tslib_1.__decorate([
24
24
  (0, platform_middlewares_1.Middleware)()
25
25
  ], AcceptMimesMiddleware);
26
26
  exports.AcceptMimesMiddleware = AcceptMimesMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"AcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/AcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,2DAA8C;AAC9C,qEAAyE;AAEzE;;;;GAIG;AAEH,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IACzB,GAAG,CAAY,GAAY;QAChC,OAAO;IACT,CAAC;CACF,CAAA;AAHC;IAAY,wBAAA,IAAA,yBAAO,GAAE,CAAA;;;;gDAEpB;AAHU,qBAAqB;IADjC,IAAA,iCAAU,GAAE;GACA,qBAAqB,CAIjC;AAJY,sDAAqB","sourcesContent":["import {Context} from \"@tsed/platform-params\";\nimport {Middleware, MiddlewareMethods} from \"@tsed/platform-middlewares\";\n\n/**\n * @middleware\n * @deprecated Since 2020-11-30. Use PlatformAcceptMimesMiddleware.\n * @ignore\n */\n@Middleware()\nexport class AcceptMimesMiddleware implements MiddlewareMethods {\n public use(@Context() ctx: Context): void {\n return;\n }\n}\n"]}
1
+ {"version":3,"file":"AcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/AcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,2DAA8C;AAC9C,qEAAyE;AAEzE;;;;GAIG;AAEH,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IACzB,GAAG,CAAY,GAAY;QAChC,OAAO;IACT,CAAC;CACF,CAAA;AAHC;IAAY,mBAAA,IAAA,yBAAO,GAAE,CAAA;;;;gDAEpB;AAHU,qBAAqB;IADjC,IAAA,iCAAU,GAAE;GACA,qBAAqB,CAIjC;AAJY,sDAAqB","sourcesContent":["import {Context} from \"@tsed/platform-params\";\nimport {Middleware, MiddlewareMethods} from \"@tsed/platform-middlewares\";\n\n/**\n * @middleware\n * @deprecated Since 2020-11-30. Use PlatformAcceptMimesMiddleware.\n * @ignore\n */\n@Middleware()\nexport class AcceptMimesMiddleware implements MiddlewareMethods {\n public use(@Context() ctx: Context): void {\n return;\n }\n}\n"]}
@@ -13,13 +13,13 @@ let GlobalAcceptMimesMiddleware = class GlobalAcceptMimesMiddleware {
13
13
  return;
14
14
  }
15
15
  };
16
- (0, tslib_1.__decorate)([
17
- (0, tslib_1.__param)(0, (0, platform_params_1.Context)()),
18
- (0, tslib_1.__metadata)("design:type", Function),
19
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
20
- (0, tslib_1.__metadata)("design:returntype", void 0)
16
+ tslib_1.__decorate([
17
+ tslib_1.__param(0, (0, platform_params_1.Context)()),
18
+ tslib_1.__metadata("design:type", Function),
19
+ tslib_1.__metadata("design:paramtypes", [Object]),
20
+ tslib_1.__metadata("design:returntype", void 0)
21
21
  ], GlobalAcceptMimesMiddleware.prototype, "use", null);
22
- GlobalAcceptMimesMiddleware = (0, tslib_1.__decorate)([
22
+ GlobalAcceptMimesMiddleware = tslib_1.__decorate([
23
23
  (0, platform_middlewares_1.Middleware)()
24
24
  ], GlobalAcceptMimesMiddleware);
25
25
  exports.GlobalAcceptMimesMiddleware = GlobalAcceptMimesMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalAcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/GlobalAcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,qEAAyE;AACzE,2DAA8C;AAE9C;;;GAGG;AAEH,IAAa,2BAA2B,GAAxC,MAAa,2BAA2B;IACtC,GAAG,CAAY,GAAY;QACzB,OAAO;IACT,CAAC;CACF,CAAA;AAHC;IAAK,wBAAA,IAAA,yBAAO,GAAE,CAAA;;;;sDAEb;AAHU,2BAA2B;IADvC,IAAA,iCAAU,GAAE;GACA,2BAA2B,CAIvC;AAJY,kEAA2B","sourcesContent":["import {Middleware, MiddlewareMethods} from \"@tsed/platform-middlewares\";\nimport {Context} from \"@tsed/platform-params\";\n\n/**\n * @deprecated Since 2020-11-30. Use PlatformAcceptMimesMiddleware.\n * @ignore\n */\n@Middleware()\nexport class GlobalAcceptMimesMiddleware implements MiddlewareMethods {\n use(@Context() ctx: Context) {\n return;\n }\n}\n"]}
1
+ {"version":3,"file":"GlobalAcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/GlobalAcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,qEAAyE;AACzE,2DAA8C;AAE9C;;;GAGG;AAEH,IAAa,2BAA2B,GAAxC,MAAa,2BAA2B;IACtC,GAAG,CAAY,GAAY;QACzB,OAAO;IACT,CAAC;CACF,CAAA;AAHC;IAAK,mBAAA,IAAA,yBAAO,GAAE,CAAA;;;;sDAEb;AAHU,2BAA2B;IADvC,IAAA,iCAAU,GAAE;GACA,2BAA2B,CAIvC;AAJY,kEAA2B","sourcesContent":["import {Middleware, MiddlewareMethods} from \"@tsed/platform-middlewares\";\nimport {Context} from \"@tsed/platform-params\";\n\n/**\n * @deprecated Since 2020-11-30. Use PlatformAcceptMimesMiddleware.\n * @ignore\n */\n@Middleware()\nexport class GlobalAcceptMimesMiddleware implements MiddlewareMethods {\n use(@Context() ctx: Context) {\n return;\n }\n}\n"]}
@@ -20,17 +20,17 @@ let PlatformAcceptMimesMiddleware = class PlatformAcceptMimesMiddleware {
20
20
  }
21
21
  }
22
22
  };
23
- (0, tslib_1.__decorate)([
23
+ tslib_1.__decorate([
24
24
  (0, di_1.Constant)("acceptMimes", []),
25
- (0, tslib_1.__metadata)("design:type", Array)
25
+ tslib_1.__metadata("design:type", Array)
26
26
  ], PlatformAcceptMimesMiddleware.prototype, "acceptMimes", void 0);
27
- (0, tslib_1.__decorate)([
28
- (0, tslib_1.__param)(0, (0, platform_params_1.Context)()),
29
- (0, tslib_1.__metadata)("design:type", Function),
30
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
31
- (0, tslib_1.__metadata)("design:returntype", void 0)
27
+ tslib_1.__decorate([
28
+ tslib_1.__param(0, (0, platform_params_1.Context)()),
29
+ tslib_1.__metadata("design:type", Function),
30
+ tslib_1.__metadata("design:paramtypes", [Object]),
31
+ tslib_1.__metadata("design:returntype", void 0)
32
32
  ], PlatformAcceptMimesMiddleware.prototype, "use", null);
33
- PlatformAcceptMimesMiddleware = (0, tslib_1.__decorate)([
33
+ PlatformAcceptMimesMiddleware = tslib_1.__decorate([
34
34
  (0, platform_middlewares_1.Middleware)()
35
35
  ], PlatformAcceptMimesMiddleware);
36
36
  exports.PlatformAcceptMimesMiddleware = PlatformAcceptMimesMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformAcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/PlatformAcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,qCAAgC;AAChC,iCAAkC;AAClC,iDAA+C;AAC/C,qEAAyE;AACzE,2DAA8C;AAE9C;;;GAGG;AAEH,IAAa,6BAA6B,GAA1C,MAAa,6BAA6B;IAIjC,GAAG,CAAY,GAAY;QAChC,MAAM,EAAC,QAAQ,EAAE,OAAO,EAAC,GAAG,GAAG,CAAC;QAChC,MAAM,KAAK,GAAG,IAAA,WAAI,EAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,aAAa,CAAC,KAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAElF,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC3C,MAAM,IAAI,0BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3C;IACH,CAAC;CACF,CAAA;AAVC;IADC,IAAA,aAAQ,EAAC,aAAa,EAAE,EAAE,CAAC;;kEACN;AAEtB;IAAY,wBAAA,IAAA,yBAAO,GAAE,CAAA;;;;wDAOpB;AAXU,6BAA6B;IADzC,IAAA,iCAAU,GAAE;GACA,6BAA6B,CAYzC;AAZY,sEAA6B","sourcesContent":["import {uniq} from \"@tsed/core\";\nimport {Constant} from \"@tsed/di\";\nimport {NotAcceptable} from \"@tsed/exceptions\";\nimport {Middleware, MiddlewareMethods} from \"@tsed/platform-middlewares\";\nimport {Context} from \"@tsed/platform-params\";\n\n/**\n * @middleware\n * @platform\n */\n@Middleware()\nexport class PlatformAcceptMimesMiddleware implements MiddlewareMethods {\n @Constant(\"acceptMimes\", [])\n acceptMimes: string[];\n\n public use(@Context() ctx: Context): void {\n const {endpoint, request} = ctx;\n const mimes = uniq((endpoint?.get(\"acceptMimes\") || []).concat(this.acceptMimes));\n\n if (mimes.length && !request.accepts(mimes)) {\n throw new NotAcceptable(mimes.join(\", \"));\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PlatformAcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/PlatformAcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,qCAAgC;AAChC,iCAAkC;AAClC,iDAA+C;AAC/C,qEAAyE;AACzE,2DAA8C;AAE9C;;;GAGG;AAEH,IAAa,6BAA6B,GAA1C,MAAa,6BAA6B;IAIjC,GAAG,CAAY,GAAY;QAChC,MAAM,EAAC,QAAQ,EAAE,OAAO,EAAC,GAAG,GAAG,CAAC;QAChC,MAAM,KAAK,GAAG,IAAA,WAAI,EAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,aAAa,CAAC,KAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAElF,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC3C,MAAM,IAAI,0BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3C;IACH,CAAC;CACF,CAAA;AAVC;IADC,IAAA,aAAQ,EAAC,aAAa,EAAE,EAAE,CAAC;;kEACN;AAEtB;IAAY,mBAAA,IAAA,yBAAO,GAAE,CAAA;;;;wDAOpB;AAXU,6BAA6B;IADzC,IAAA,iCAAU,GAAE;GACA,6BAA6B,CAYzC;AAZY,sEAA6B","sourcesContent":["import {uniq} from \"@tsed/core\";\nimport {Constant} from \"@tsed/di\";\nimport {NotAcceptable} from \"@tsed/exceptions\";\nimport {Middleware, MiddlewareMethods} from \"@tsed/platform-middlewares\";\nimport {Context} from \"@tsed/platform-params\";\n\n/**\n * @middleware\n * @platform\n */\n@Middleware()\nexport class PlatformAcceptMimesMiddleware implements MiddlewareMethods {\n @Constant(\"acceptMimes\", [])\n acceptMimes: string[];\n\n public use(@Context() ctx: Context): void {\n const {endpoint, request} = ctx;\n const mimes = uniq((endpoint?.get(\"acceptMimes\") || []).concat(this.acceptMimes));\n\n if (mimes.length && !request.accepts(mimes)) {\n throw new NotAcceptable(mimes.join(\", \"));\n }\n }\n}\n"]}
@@ -45,21 +45,21 @@ let PlatformMulterMiddleware = PlatformMulterMiddleware_1 = class PlatformMulter
45
45
  return conf.fields.map(({ name, maxCount }) => ({ name, maxCount }));
46
46
  }
47
47
  };
48
- (0, tslib_1.__decorate)([
48
+ tslib_1.__decorate([
49
49
  (0, di_1.Constant)("multer", {}),
50
- (0, tslib_1.__metadata)("design:type", Object)
50
+ tslib_1.__metadata("design:type", Object)
51
51
  ], PlatformMulterMiddleware.prototype, "settings", void 0);
52
- (0, tslib_1.__decorate)([
52
+ tslib_1.__decorate([
53
53
  (0, di_1.Inject)(),
54
- (0, tslib_1.__metadata)("design:type", PlatformApplication_1.PlatformApplication)
54
+ tslib_1.__metadata("design:type", PlatformApplication_1.PlatformApplication)
55
55
  ], PlatformMulterMiddleware.prototype, "app", void 0);
56
- (0, tslib_1.__decorate)([
57
- (0, tslib_1.__param)(0, (0, platform_params_1.Context)()),
58
- (0, tslib_1.__metadata)("design:type", Function),
59
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
60
- (0, tslib_1.__metadata)("design:returntype", Promise)
56
+ tslib_1.__decorate([
57
+ tslib_1.__param(0, (0, platform_params_1.Context)()),
58
+ tslib_1.__metadata("design:type", Function),
59
+ tslib_1.__metadata("design:paramtypes", [Object]),
60
+ tslib_1.__metadata("design:returntype", Promise)
61
61
  ], PlatformMulterMiddleware.prototype, "use", null);
62
- PlatformMulterMiddleware = PlatformMulterMiddleware_1 = (0, tslib_1.__decorate)([
62
+ PlatformMulterMiddleware = PlatformMulterMiddleware_1 = tslib_1.__decorate([
63
63
  (0, platform_middlewares_1.Middleware)()
64
64
  ], PlatformMulterMiddleware);
65
65
  exports.PlatformMulterMiddleware = PlatformMulterMiddleware;