@tsed/common 6.87.0 → 6.88.1

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.
@@ -113,5 +113,4 @@ export declare abstract class PlatformBuilder<App = TsED.Application, Router = T
113
113
  protected listenServers(): Promise<void>;
114
114
  protected logRoutes(): Promise<void>;
115
115
  protected loadRoutes(): Promise<void>;
116
- protected createInjector(module: Type<any>, providers: IProvider[], settings: any): void;
117
116
  }
@@ -6,6 +6,7 @@ export * from "./method/acceptMime";
6
6
  export * from "./method/location";
7
7
  export * from "./method/redirect";
8
8
  export * from "./method/endpointFn";
9
+ export * from "./method/view";
9
10
  export * from "./params/responseData";
10
11
  export * from "./params/response";
11
12
  export * from "./params/request";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Use a view and sends the rendered HTML string to the client. Optional parameter:
3
+ *
4
+ * * viewOptions, an object whose properties define local variables for the view.
5
+ *
6
+ * The view argument is a string that is the file path of the view file to render.
7
+ * This can be an absolute path, or a path relative to the views setting.
8
+ * If the path does not contain a file extension, then the view engine setting determines the file extension.
9
+ * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
10
+ * and render it using the loaded module’s __express function.
11
+ *
12
+ * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
13
+ *
14
+ * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
15
+ * and as so for security reasons should not contain input from the end-user.
16
+ *
17
+ * @param path Relative path to the view file.
18
+ * @param options Additional options
19
+ * @decorator
20
+ * @operation
21
+ * @response
22
+ * @ignores
23
+ * @deprecated Use View decorator from @tsed/platform-views instead.
24
+ */
25
+ export declare function View(path: string, options?: Object): MethodDecorator;
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from "@tsed/platform-exceptions";
6
6
  export * from "@tsed/platform-response-filter";
7
7
  export * from "@tsed/platform-cache";
8
8
  export * from "@tsed/platform-middlewares";
9
- export * from "@tsed/platform-views";
10
9
  export * from "@tsed/components-scan";
11
10
  export * from "@tsed/platform-log-middleware";
12
11
  export { $log, Logger } from "@tsed/logger";
package/lib/index.js CHANGED
@@ -6,7 +6,6 @@ var platformExceptions = require('@tsed/platform-exceptions');
6
6
  var platformResponseFilter = require('@tsed/platform-response-filter');
7
7
  var platformCache = require('@tsed/platform-cache');
8
8
  var platformMiddlewares = require('@tsed/platform-middlewares');
9
- var platformViews = require('@tsed/platform-views');
10
9
  var componentsScan = require('@tsed/components-scan');
11
10
  var platformLogMiddleware = require('@tsed/platform-log-middleware');
12
11
  var tslib = require('tslib');
@@ -14,8 +13,8 @@ var core = require('@tsed/core');
14
13
  var exceptions = require('@tsed/exceptions');
15
14
  var schema = require('@tsed/schema');
16
15
  var util = require('util');
17
- var Http = require('http');
18
16
  var Https = require('https');
17
+ var Http = require('http');
19
18
 
20
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
20
 
@@ -39,8 +38,8 @@ function _interopNamespace(e) {
39
38
  return n;
40
39
  }
41
40
 
42
- var Http__default = /*#__PURE__*/_interopDefaultLegacy(Http);
43
41
  var Https__default = /*#__PURE__*/_interopDefaultLegacy(Https);
42
+ var Http__default = /*#__PURE__*/_interopDefaultLegacy(Http);
44
43
 
45
44
  function _extends() {
46
45
  _extends = Object.assign || function (target) {
@@ -1489,7 +1488,8 @@ function buildRouter(injector, provider) {
1489
1488
  exports.PlatformRequest = class PlatformRequest {
1490
1489
  constructor({
1491
1490
  request
1492
- }) {
1491
+ }, $ctx) {
1492
+ this.$ctx = $ctx;
1493
1493
  this.raw = request;
1494
1494
  }
1495
1495
 
@@ -1620,7 +1620,9 @@ exports.PlatformRequest = class PlatformRequest {
1620
1620
  // @ts-ignore
1621
1621
  delete this.raw; // @ts-ignore
1622
1622
 
1623
- delete this.response;
1623
+ delete this.response; // @ts-ignore
1624
+
1625
+ delete this.$ctx;
1624
1626
  }
1625
1627
  /**
1626
1628
  * Return the Framework response object (express, koa, etc...)
@@ -1640,7 +1642,7 @@ exports.PlatformRequest = class PlatformRequest {
1640
1642
  }
1641
1643
 
1642
1644
  };
1643
- exports.PlatformRequest = tslib.__decorate([di.Injectable(), di.Scope(di.ProviderScope.INSTANCE), tslib.__metadata("design:paramtypes", [Object])], exports.PlatformRequest);
1645
+ exports.PlatformRequest = tslib.__decorate([di.Injectable(), di.Scope(di.ProviderScope.INSTANCE), tslib.__metadata("design:paramtypes", [Object, Function])], exports.PlatformRequest);
1644
1646
 
1645
1647
  var PlatformResponse_1;
1646
1648
 
@@ -1654,7 +1656,8 @@ const onFinished = require("on-finished");
1654
1656
  exports.PlatformResponse = PlatformResponse_1 = class PlatformResponse {
1655
1657
  constructor({
1656
1658
  response
1657
- }) {
1659
+ }, $ctx) {
1660
+ this.$ctx = $ctx;
1658
1661
  this.raw = response;
1659
1662
  }
1660
1663
  /**
@@ -1871,7 +1874,11 @@ exports.PlatformResponse = PlatformResponse_1 = class PlatformResponse {
1871
1874
 
1872
1875
 
1873
1876
  async render(path, options = {}) {
1874
- return this.platformViews.render(path, _extends({}, this.locals, options));
1877
+ const {
1878
+ PlatformViews
1879
+ } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@tsed/platform-views')); });
1880
+ const platformViews = await this.$ctx.injector.lazyInvoke(PlatformViews);
1881
+ return platformViews.render(path, _extends({}, this.locals, options));
1875
1882
  }
1876
1883
  /**
1877
1884
  * Send any data to your consumer.
@@ -1943,7 +1950,9 @@ exports.PlatformResponse = PlatformResponse_1 = class PlatformResponse {
1943
1950
  delete this.raw;
1944
1951
  delete this.data; // @ts-ignore
1945
1952
 
1946
- delete this.request;
1953
+ delete this.request; // @ts-ignore
1954
+
1955
+ delete this.$ctx;
1947
1956
  }
1948
1957
 
1949
1958
  isHeadersSent() {
@@ -1951,7 +1960,7 @@ exports.PlatformResponse = PlatformResponse_1 = class PlatformResponse {
1951
1960
  }
1952
1961
 
1953
1962
  };
1954
- exports.PlatformResponse = PlatformResponse_1 = tslib.__decorate([di.Injectable(), di.Scope(di.ProviderScope.INSTANCE), tslib.__metadata("design:paramtypes", [Object])], exports.PlatformResponse);
1963
+ exports.PlatformResponse = PlatformResponse_1 = tslib.__decorate([di.Injectable(), di.Scope(di.ProviderScope.INSTANCE), tslib.__metadata("design:paramtypes", [Object, Function])], exports.PlatformResponse);
1955
1964
 
1956
1965
  const _excluded$2 = ["event", "endpoint", "ignoreUrlPatterns", "ResponseKlass", "RequestKlass"];
1957
1966
  class PlatformContext extends di.DIContext {
@@ -1973,8 +1982,8 @@ class PlatformContext extends di.DIContext {
1973
1982
  this.ignoreUrlPatterns = [];
1974
1983
  endpoint && (this.endpoint = endpoint);
1975
1984
  this.ignoreUrlPatterns = ignoreUrlPatterns.map(pattern => typeof pattern === "string" ? new RegExp(pattern, "gi") : pattern);
1976
- this.response = new ResponseKlass(event);
1977
- this.request = new RequestKlass(event);
1985
+ this.response = new ResponseKlass(event, this);
1986
+ this.request = new RequestKlass(event, this);
1978
1987
  this.response.request = this.request;
1979
1988
  this.request.response = this.response;
1980
1989
  this.request.request.$ctx = this;
@@ -2215,42 +2224,21 @@ exports.Platform = tslib.__decorate([di.Injectable({
2215
2224
  imports: [exports.PlatformMiddlewaresChain]
2216
2225
  }), tslib.__metadata("design:paramtypes", [di.InjectorService, exports.PlatformApplication])], exports.Platform);
2217
2226
 
2218
- logger.$log.name = "TSED";
2219
- function createInjector(settings = {}) {
2220
- const injector = new di.InjectorService();
2221
- injector.settings = createSettingsService(injector);
2222
- injector.logger = logger.$log;
2223
- injector.settings.set(settings);
2224
- di.setLoggerLevel(injector);
2225
- return injector;
2226
- }
2227
-
2228
- function createSettingsService(injector) {
2229
- const provider = di.GlobalProviders.get(exports.PlatformConfiguration).clone();
2230
- provider.instance = injector.invoke(provider.useClass);
2231
- injector.addProvider(exports.PlatformConfiguration, provider);
2232
- return provider.instance;
2233
- }
2234
-
2235
- function createPlatformApplication(injector) {
2236
- injector.forkProvider(exports.PlatformApplication);
2237
- }
2238
-
2239
2227
  /**
2240
- * Inject the Http.Server instance.
2228
+ * Inject the Https.Server instance.
2241
2229
  *
2242
2230
  * ### Example
2243
2231
  *
2244
2232
  * ```typescript
2245
- * import {HttpServer, Service} from "@tsed/common";
2233
+ * import {HttpsServer, Service} from "@tsed/common";
2246
2234
  *
2247
2235
  * @Service()
2248
2236
  * export default class OtherService {
2249
- * constructor(@HttpServer httpServer: HttpServer) {}
2237
+ * constructor(@HttpsServer httpServer: HttpServer) {}
2250
2238
  * }
2251
2239
  * ```
2252
2240
  *
2253
- * > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
2241
+ * > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
2254
2242
  *
2255
2243
  * @param {Type<any>} target
2256
2244
  * @param {string} targetKey
@@ -2259,8 +2247,8 @@ function createPlatformApplication(injector) {
2259
2247
  * @decorator
2260
2248
  */
2261
2249
 
2262
- function HttpServer(target, targetKey, descriptor) {
2263
- return di.Inject(HttpServer)(target, targetKey, descriptor);
2250
+ function HttpsServer(target, targetKey, descriptor) {
2251
+ return di.Inject(HttpsServer)(target, targetKey, descriptor);
2264
2252
  }
2265
2253
 
2266
2254
  function listenServer(http, settings) {
@@ -2282,56 +2270,57 @@ function listenServer(http, settings) {
2282
2270
  return promise;
2283
2271
  }
2284
2272
 
2285
- function createHttpServer(injector) {
2286
- injector.forkProvider(HttpServer);
2273
+ function createHttpsServer(injector) {
2274
+ injector.invoke(HttpsServer);
2287
2275
  }
2288
2276
  di.registerProvider({
2289
- provide: HttpServer,
2290
- deps: [exports.PlatformApplication],
2277
+ provide: HttpsServer,
2278
+ deps: [exports.PlatformApplication, di.Configuration],
2291
2279
  scope: di.ProviderScope.SINGLETON,
2292
2280
  global: true,
2293
2281
 
2294
- useFactory(platformApplication) {
2295
- return Http__default['default'].createServer(platformApplication.callback());
2282
+ useFactory(platformApplication, settings) {
2283
+ const options = settings.httpsOptions;
2284
+ return Https__default['default'].createServer(options, platformApplication.callback());
2296
2285
  }
2297
2286
 
2298
2287
  });
2299
- async function listenHttpServer(injector) {
2288
+ async function listenHttpsServer(injector) {
2300
2289
  const {
2301
2290
  settings
2302
2291
  } = injector;
2303
- const server = injector.get(HttpServer);
2292
+ const server = injector.get(HttpsServer);
2304
2293
 
2305
- if (settings.httpPort !== false && server) {
2294
+ if (settings.httpsPort !== false && server) {
2306
2295
  const {
2307
2296
  address,
2308
2297
  port
2309
- } = settings.getHttpPort();
2310
- injector.logger.debug(`Start server on http://${address}:${port}`);
2298
+ } = settings.getHttpsPort();
2299
+ injector.logger.debug(`Start server on https://${address}:${port}`);
2311
2300
  const options = await listenServer(server, {
2312
2301
  address,
2313
2302
  port
2314
2303
  });
2315
- settings.setHttpPort(options);
2316
- injector.logger.info(`Listen server on http://${options.address}:${options.port}`);
2304
+ settings.setHttpsPort(options);
2305
+ injector.logger.info(`Listen server on https://${options.address}:${options.port}`);
2317
2306
  }
2318
2307
  }
2319
2308
 
2320
2309
  /**
2321
- * Inject the Https.Server instance.
2310
+ * Inject the Http.Server instance.
2322
2311
  *
2323
2312
  * ### Example
2324
2313
  *
2325
2314
  * ```typescript
2326
- * import {HttpsServer, Service} from "@tsed/common";
2315
+ * import {HttpServer, Service} from "@tsed/common";
2327
2316
  *
2328
2317
  * @Service()
2329
2318
  * export default class OtherService {
2330
- * constructor(@HttpsServer httpServer: HttpServer) {}
2319
+ * constructor(@HttpServer httpServer: HttpServer) {}
2331
2320
  * }
2332
2321
  * ```
2333
2322
  *
2334
- * > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
2323
+ * > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
2335
2324
  *
2336
2325
  * @param {Type<any>} target
2337
2326
  * @param {string} targetKey
@@ -2340,46 +2329,79 @@ async function listenHttpServer(injector) {
2340
2329
  * @decorator
2341
2330
  */
2342
2331
 
2343
- function HttpsServer(target, targetKey, descriptor) {
2344
- return di.Inject(HttpsServer)(target, targetKey, descriptor);
2332
+ function HttpServer(target, targetKey, descriptor) {
2333
+ return di.Inject(HttpServer)(target, targetKey, descriptor);
2345
2334
  }
2346
2335
 
2347
- function createHttpsServer(injector) {
2348
- injector.forkProvider(HttpsServer);
2336
+ function createHttpServer(injector) {
2337
+ injector.invoke(HttpServer);
2349
2338
  }
2350
2339
  di.registerProvider({
2351
- provide: HttpsServer,
2352
- deps: [exports.PlatformApplication, di.Configuration],
2340
+ provide: HttpServer,
2341
+ deps: [exports.PlatformApplication],
2353
2342
  scope: di.ProviderScope.SINGLETON,
2354
2343
  global: true,
2355
2344
 
2356
- useFactory(platformApplication, settings) {
2357
- const options = settings.httpsOptions;
2358
- return Https__default['default'].createServer(options, platformApplication.callback());
2345
+ useFactory(platformApplication) {
2346
+ return Http__default['default'].createServer(platformApplication.callback());
2359
2347
  }
2360
2348
 
2361
2349
  });
2362
- async function listenHttpsServer(injector) {
2350
+ async function listenHttpServer(injector) {
2363
2351
  const {
2364
2352
  settings
2365
2353
  } = injector;
2366
- const server = injector.get(HttpsServer);
2354
+ const server = injector.get(HttpServer);
2367
2355
 
2368
- if (settings.httpsPort !== false && server) {
2356
+ if (settings.httpPort !== false && server) {
2369
2357
  const {
2370
2358
  address,
2371
2359
  port
2372
- } = settings.getHttpsPort();
2373
- injector.logger.debug(`Start server on https://${address}:${port}`);
2360
+ } = settings.getHttpPort();
2361
+ injector.logger.debug(`Start server on http://${address}:${port}`);
2374
2362
  const options = await listenServer(server, {
2375
2363
  address,
2376
2364
  port
2377
2365
  });
2378
- settings.setHttpsPort(options);
2379
- injector.logger.info(`Listen server on https://${options.address}:${options.port}`);
2366
+ settings.setHttpPort(options);
2367
+ injector.logger.info(`Listen server on http://${options.address}:${options.port}`);
2380
2368
  }
2381
2369
  }
2382
2370
 
2371
+ logger.$log.name = "TSED";
2372
+ const DEFAULT_PROVIDERS = [{
2373
+ provide: exports.PlatformHandler
2374
+ }, {
2375
+ provide: exports.PlatformResponse
2376
+ }, {
2377
+ provide: exports.PlatformRequest
2378
+ }, {
2379
+ provide: exports.PlatformRouter
2380
+ }, {
2381
+ provide: exports.PlatformApplication
2382
+ }, {
2383
+ provide: exports.Platform
2384
+ }];
2385
+ function createInjector({
2386
+ providers = [],
2387
+ settings = {}
2388
+ }) {
2389
+ const injector = new di.InjectorService();
2390
+ injector.addProvider(exports.PlatformConfiguration);
2391
+ injector.settings = injector.invoke(exports.PlatformConfiguration);
2392
+ injector.logger = logger.$log;
2393
+ injector.settings.set(settings);
2394
+ di.setLoggerLevel(injector);
2395
+ providers = [...DEFAULT_PROVIDERS, ...providers];
2396
+ core.toMap(providers, "provide").forEach((provider, token) => {
2397
+ injector.addProvider(token, provider);
2398
+ });
2399
+ injector.invoke(exports.PlatformApplication);
2400
+ createHttpsServer(injector);
2401
+ createHttpServer(injector);
2402
+ return injector;
2403
+ }
2404
+
2383
2405
  /**
2384
2406
  * @ignore
2385
2407
  * @deprecated User injector.load(container, module) instead
@@ -2438,7 +2460,6 @@ function createContext(injector) {
2438
2460
 
2439
2461
  const ResponseKlass = (_injector$getProvider = injector.getProvider(exports.PlatformResponse)) == null ? void 0 : _injector$getProvider.useClass;
2440
2462
  const RequestKlass = (_injector$getProvider2 = injector.getProvider(exports.PlatformRequest)) == null ? void 0 : _injector$getProvider2.useClass;
2441
- const platformViews$1 = injector.get(platformViews.PlatformViews);
2442
2463
 
2443
2464
  const _ref = injector.settings.logger || {},
2444
2465
  {
@@ -2456,7 +2477,6 @@ function createContext(injector) {
2456
2477
  ResponseKlass,
2457
2478
  RequestKlass
2458
2479
  }));
2459
- ctx.response.platformViews = platformViews$1;
2460
2480
  ctx.response.onEnd(async () => {
2461
2481
  await ctx.emit("$onResponse", ctx);
2462
2482
  await ctx.destroy();
@@ -2520,19 +2540,6 @@ function getConfiguration(configuration = {}, module = null) {
2520
2540
  return config;
2521
2541
  }
2522
2542
 
2523
- const DEFAULT_PROVIDERS = [{
2524
- provide: exports.PlatformHandler
2525
- }, {
2526
- provide: exports.PlatformResponse
2527
- }, {
2528
- provide: exports.PlatformRequest
2529
- }, {
2530
- provide: exports.PlatformRouter
2531
- }, {
2532
- provide: exports.PlatformApplication
2533
- }, {
2534
- provide: exports.Platform
2535
- }];
2536
2543
  /**
2537
2544
  * @platform
2538
2545
  */
@@ -2561,7 +2568,13 @@ class PlatformBuilder {
2561
2568
  this.current = new Date();
2562
2569
  this.name = name;
2563
2570
  _classPrivateFieldLooseBase(this, _rootModule)[_rootModule] = module;
2564
- this.createInjector(module, providers, settings);
2571
+ const configuration = getConfiguration(settings, module);
2572
+ configuration.PLATFORM_NAME = name;
2573
+ _classPrivateFieldLooseBase(this, _injector)[_injector] = createInjector({
2574
+ settings: configuration,
2575
+ providers
2576
+ });
2577
+ this.log("Injector created...");
2565
2578
  }
2566
2579
 
2567
2580
  get injector() {
@@ -2840,20 +2853,6 @@ class PlatformBuilder {
2840
2853
  await this.callHook("$afterRoutesInit");
2841
2854
  }
2842
2855
 
2843
- createInjector(module, providers, settings) {
2844
- const configuration = getConfiguration(settings, module);
2845
- configuration.PLATFORM_NAME = this.name;
2846
- _classPrivateFieldLooseBase(this, _injector)[_injector] = createInjector(configuration);
2847
- providers = [...DEFAULT_PROVIDERS, ...providers];
2848
- core.toMap(providers, "provide").forEach((provider, token) => {
2849
- this.injector.addProvider(token, provider);
2850
- });
2851
- createPlatformApplication(this.injector);
2852
- createHttpsServer(this.injector);
2853
- createHttpServer(this.injector);
2854
- this.log("Injector created...");
2855
- }
2856
-
2857
2856
  }
2858
2857
 
2859
2858
  /**
@@ -3044,6 +3043,39 @@ function EndpointFn(fn) {
3044
3043
  return schema.JsonEntityFn(fn);
3045
3044
  }
3046
3045
 
3046
+ /**
3047
+ * Use a view and sends the rendered HTML string to the client. Optional parameter:
3048
+ *
3049
+ * * viewOptions, an object whose properties define local variables for the view.
3050
+ *
3051
+ * The view argument is a string that is the file path of the view file to render.
3052
+ * This can be an absolute path, or a path relative to the views setting.
3053
+ * If the path does not contain a file extension, then the view engine setting determines the file extension.
3054
+ * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
3055
+ * and render it using the loaded module’s __express function.
3056
+ *
3057
+ * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
3058
+ *
3059
+ * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
3060
+ * and as so for security reasons should not contain input from the end-user.
3061
+ *
3062
+ * @param path Relative path to the view file.
3063
+ * @param options Additional options
3064
+ * @decorator
3065
+ * @operation
3066
+ * @response
3067
+ * @ignores
3068
+ * @deprecated Use View decorator from @tsed/platform-views instead.
3069
+ */
3070
+ // istanbul ignore next
3071
+
3072
+ function View(path, options) {
3073
+ return core.StoreSet("view", {
3074
+ path,
3075
+ options
3076
+ });
3077
+ }
3078
+
3047
3079
  /**
3048
3080
  * Return the current response data. Prefer the @@Context@@ decorator to get or set data.
3049
3081
  *
@@ -3226,8 +3258,8 @@ function mapReturnedResponse(_ref) {
3226
3258
  */
3227
3259
 
3228
3260
  class PlatformTest extends di.DITest {
3229
- static async create(options = {}) {
3230
- di.DITest.injector = PlatformTest.createInjector(getConfiguration(options, null));
3261
+ static async create(settings = {}) {
3262
+ di.DITest.injector = PlatformTest.createInjector(getConfiguration(settings));
3231
3263
  const container = di.createContainer();
3232
3264
  await di.DITest.injector.load(container);
3233
3265
  }
@@ -3237,7 +3269,10 @@ class PlatformTest extends di.DITest {
3237
3269
 
3238
3270
 
3239
3271
  static createInjector(settings = {}) {
3240
- return createInjector(di.DITest.configure(settings));
3272
+ return createInjector({
3273
+ providers: [],
3274
+ settings: di.DITest.configure(settings)
3275
+ });
3241
3276
  }
3242
3277
  /**
3243
3278
  * Load the server silently without listening port and configure it on test profile.
@@ -3401,7 +3436,7 @@ class PlatformTest extends di.DITest {
3401
3436
  request: (options == null ? void 0 : (_options$request = options.request) == null ? void 0 : _options$request.request) || (options == null ? void 0 : (_options$event = options.event) == null ? void 0 : _options$event.request) || PlatformTest.createRequest(),
3402
3437
  response: (options == null ? void 0 : (_options$response = options.response) == null ? void 0 : _options$response.response) || (options == null ? void 0 : (_options$event2 = options.event) == null ? void 0 : _options$event2.response) || PlatformTest.createResponse()
3403
3438
  };
3404
- const ctx = new PlatformContext(_extends({
3439
+ return new PlatformContext(_extends({
3405
3440
  id: "id",
3406
3441
  injector: di.DITest.injector,
3407
3442
  logger: di.DITest.injector.logger,
@@ -3409,8 +3444,6 @@ class PlatformTest extends di.DITest {
3409
3444
  }, options, {
3410
3445
  event
3411
3446
  }));
3412
- ctx.response.platformViews = PlatformTest.get(platformViews.PlatformViews);
3413
- return ctx;
3414
3447
  }
3415
3448
 
3416
3449
  }
@@ -3518,13 +3551,13 @@ exports.Request = Request;
3518
3551
  exports.Res = Res;
3519
3552
  exports.Response = Response;
3520
3553
  exports.ResponseData = ResponseData;
3554
+ exports.View = View;
3521
3555
  exports.bindEndpointMiddleware = bindEndpointMiddleware;
3522
3556
  exports.buildRouter = buildRouter;
3523
3557
  exports.createContext = createContext;
3524
3558
  exports.createHttpServer = createHttpServer;
3525
3559
  exports.createHttpsServer = createHttpsServer;
3526
3560
  exports.createInjector = createInjector;
3527
- exports.createPlatformApplication = createPlatformApplication;
3528
3561
  exports.createRouter = createRouter;
3529
3562
  exports.getRouter = getRouter;
3530
3563
  exports.listenHttpServer = listenHttpServer;
@@ -3582,14 +3615,6 @@ Object.keys(platformMiddlewares).forEach(function (k) {
3582
3615
  }
3583
3616
  });
3584
3617
  });
3585
- Object.keys(platformViews).forEach(function (k) {
3586
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
3587
- enumerable: true,
3588
- get: function () {
3589
- return platformViews[k];
3590
- }
3591
- });
3592
- });
3593
3618
  Object.keys(componentsScan).forEach(function (k) {
3594
3619
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
3595
3620
  enumerable: true,