@tsed/common 6.75.11 → 6.77.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.
@@ -1,4 +1,7 @@
1
- import { DIConfiguration, ProviderType, ProviderScope, Injectable, Inject, InjectorService, Constant, Scope, DIContext, Provider, setLoggerLevel, GlobalProviders, registerProvider, Configuration, createContainer, Container, getConfiguration, DITest } from '@tsed/di';
1
+ import { $log, colorize } from '@tsed/logger';
2
+ export { $log, Logger } from '@tsed/logger';
3
+ import '@tsed/logger-file';
4
+ import { DIConfiguration, ProviderType, ProviderScope, Injectable, Inject, InjectorService, Constant, Scope, DIContext, Provider, GlobalProviders, setLoggerLevel, registerProvider, Configuration, createContainer, Container, getConfiguration, DITest } from '@tsed/di';
2
5
  export * from '@tsed/di';
3
6
  import { ParamTypes, ParamMetadata, PlatformParams, Context, UseParam, mapParamsOptions } from '@tsed/platform-params';
4
7
  export * from '@tsed/platform-params';
@@ -13,13 +16,11 @@ export * from '@tsed/platform-views';
13
16
  import { importProviders } from '@tsed/components-scan';
14
17
  export * from '@tsed/components-scan';
15
18
  export * from '@tsed/platform-log-middleware';
16
- import { $log, colorize } from '@tsed/logger';
17
- export { $log, Logger } from '@tsed/logger';
18
19
  import { __decorate, __metadata, __param } from 'tslib';
19
- import { Env, AnyToPromise, AnyToPromiseStatus, nameOf, Store, descriptorOf, classOf, prototypeOf, deepMerge, isFunction, DecoratorTypes, isStream, uniq, isBoolean, isNumber, isString, getValue, toMap, constructorOf, StoreMerge, Metadata, useDecorators, useMethodDecorators, isClass } from '@tsed/core';
20
+ import { Env, AnyToPromise, AnyToPromiseStatus, nameOf, Store, descriptorOf, prototypeOf, deepMerge, isFunction, DecoratorTypes, isStream, uniq, isBoolean, isNumber, isString, getValue, toMap, StoreMerge, Metadata, useDecorators, useMethodDecorators, StoreSet, isClass } from '@tsed/core';
20
21
  import { PerfLogger } from '@tsed/perf';
21
22
  import { Exception, NotAcceptable } from '@tsed/exceptions';
22
- import { JsonEntityStore, getOperationsStores, JsonEntityComponent, OperationMethods, getProperties, Returns, Consumes, JsonEntityFn, Produces } from '@tsed/schema';
23
+ import { JsonEntityStore, JsonEntityComponent, getOperationsRoutes, OperationMethods, JsonOperationRoute, getProperties, concatPath, Returns, Consumes, Produces, JsonEntityFn } from '@tsed/schema';
23
24
  export { All, Delete, Get, Head, Location, Options, Patch, Post, Put, Redirect } from '@tsed/schema';
24
25
  import { promisify } from 'util';
25
26
  import Http, { ServerResponse, IncomingMessage } from 'http';
@@ -491,7 +492,6 @@ class HandlerMetadata {
491
492
 
492
493
  }
493
494
 
494
- var EndpointMetadata_1;
495
495
  /**
496
496
  * EndpointMetadata contains metadata about a controller and his method.
497
497
  * Each annotation (@Get, @Body...) attached to a method are stored in a endpoint.
@@ -509,7 +509,7 @@ var EndpointMetadata_1;
509
509
  *
510
510
  */
511
511
 
512
- let EndpointMetadata = EndpointMetadata_1 = class EndpointMetadata extends JsonEntityStore {
512
+ let EndpointMetadata = class EndpointMetadata extends JsonEntityStore {
513
513
  constructor(options) {
514
514
  super(_extends({
515
515
  store: Store.fromMethod(options.target, options.propertyKey),
@@ -563,21 +563,6 @@ let EndpointMetadata = EndpointMetadata_1 = class EndpointMetadata extends JsonE
563
563
  set acceptMimes(mimes) {
564
564
  this.store.set("acceptMimes", mimes);
565
565
  }
566
- /**
567
- * Get all endpoints from a given class and his parents.
568
- * @param {Type<any>} target
569
- * @returns {EndpointMetadata[]}
570
- */
571
-
572
-
573
- static getEndpoints(target) {
574
- const operations = getOperationsStores(target);
575
- return Array.from(operations.values()).map(endpoint => {
576
- endpoint = endpoint.clone();
577
- endpoint.token = classOf(target);
578
- return endpoint;
579
- });
580
- }
581
566
  /**
582
567
  * Get an endpoint.
583
568
  * @param target
@@ -639,26 +624,8 @@ let EndpointMetadata = EndpointMetadata_1 = class EndpointMetadata extends JsonE
639
624
  return this;
640
625
  }
641
626
 
642
- clone() {
643
- const endpoint = new EndpointMetadata_1(_extends({}, this, {
644
- target: this.target,
645
- propertyKey: this.propertyKey,
646
- descriptor: this.descriptor,
647
- store: this.store,
648
- children: this.children
649
- }));
650
- endpoint.collectionType = this.collectionType;
651
- endpoint._type = this._type;
652
- endpoint._operation = this.operation;
653
- endpoint._schema = this._schema;
654
- endpoint.middlewares = [...this.middlewares];
655
- endpoint.afterMiddlewares = [...this.afterMiddlewares];
656
- endpoint.beforeMiddlewares = [...this.beforeMiddlewares];
657
- return endpoint;
658
- }
659
-
660
627
  };
661
- EndpointMetadata = EndpointMetadata_1 = __decorate([JsonEntityComponent(DecoratorTypes.METHOD), __metadata("design:paramtypes", [Object])], EndpointMetadata);
628
+ EndpointMetadata = __decorate([JsonEntityComponent(DecoratorTypes.METHOD), __metadata("design:paramtypes", [Object])], EndpointMetadata);
662
629
 
663
630
  function isMetadata(input) {
664
631
  return input instanceof HandlerMetadata;
@@ -676,7 +643,7 @@ function createHandlerMetadata(injector, obj, routeOptions = {}) {
676
643
  let options;
677
644
 
678
645
  if (obj instanceof EndpointMetadata) {
679
- const provider = injector.getProvider(obj.token);
646
+ const provider = injector.getProvider(routeOptions.token);
680
647
  options = {
681
648
  token: provider.token,
682
649
  target: provider.useClass,
@@ -1028,6 +995,7 @@ PlatformHandler = __decorate([Injectable({
1028
995
  scope: ProviderScope.SINGLETON
1029
996
  }), __metadata("design:paramtypes", [InjectorService, PlatformParams])], PlatformHandler);
1030
997
 
998
+ const _excluded$3 = ["method", "path", "handlers"];
1031
999
  var PlatformRouter_1;
1032
1000
  /**
1033
1001
  * @ignore
@@ -1079,15 +1047,15 @@ let PlatformRouter = PlatformRouter_1 = class PlatformRouter {
1079
1047
  const {
1080
1048
  method,
1081
1049
  path,
1082
- handlers,
1083
- isFinal
1084
- } = options; // @ts-ignore
1050
+ handlers
1051
+ } = options,
1052
+ opts = _objectWithoutPropertiesLoose(options, _excluded$3); // @ts-ignore
1085
1053
 
1086
- this.getRouter()[method](path, ...this.mapHandlers(handlers, {
1054
+
1055
+ this.getRouter()[method](path, ...this.mapHandlers(handlers, _extends({
1087
1056
  method,
1088
- path,
1089
- isFinal
1090
- }));
1057
+ path
1058
+ }, opts)));
1091
1059
  return this;
1092
1060
  }
1093
1061
 
@@ -1376,7 +1344,6 @@ class PlatformControllerBuilder {
1376
1344
  this.provider = provider;
1377
1345
  }
1378
1346
  /**
1379
- *
1380
1347
  * @returns {any}
1381
1348
  */
1382
1349
 
@@ -1396,48 +1363,32 @@ class PlatformControllerBuilder {
1396
1363
  }
1397
1364
 
1398
1365
  buildEndpoints() {
1399
- const {
1400
- endpoints
1401
- } = this.provider;
1402
- const operationPaths = new Map();
1403
-
1404
- const getKey = (method, path) => `${method}-${path}`;
1405
-
1406
- const updateFinalRouteState = key => {
1407
- if (operationPaths.has(key)) {
1408
- operationPaths.get(key).isFinal = false;
1409
- }
1410
- };
1411
-
1412
- const setFinalRoute = (key, operationPath) => {
1413
- operationPaths.set(key, operationPath);
1414
- operationPath.isFinal = true;
1415
- };
1416
-
1417
- endpoints.forEach(({
1418
- operation
1419
- }) => {
1420
- operation == null ? void 0 : operation.operationPaths.forEach(operationPath => {
1421
- if (operationPath.method !== OperationMethods.CUSTOM) {
1422
- const key = getKey(operationPath.method, operationPath.path);
1423
- updateFinalRouteState(key);
1424
- updateFinalRouteState(getKey(OperationMethods.ALL, operationPath.path));
1425
- setFinalRoute(key, operationPath);
1426
- }
1427
- });
1428
- });
1429
- endpoints.forEach(endpoint => {
1430
- this.buildEndpoint(endpoint);
1366
+ getOperationsRoutes(this.provider.token).forEach(operationRoute => {
1367
+ this.buildEndpoint(operationRoute);
1431
1368
  });
1432
1369
  return this;
1433
1370
  }
1434
1371
 
1435
- buildEndpoint(endpoint) {
1372
+ buildEndpoint(operationRoute) {
1373
+ let handlers = this.getMiddlewares(operationRoute);
1374
+ const router = this.provider.getRouter();
1375
+ router.addRoute({
1376
+ handlers,
1377
+ token: operationRoute.token,
1378
+ method: formatMethod(operationRoute.method),
1379
+ path: operationRoute.path,
1380
+ isFinal: operationRoute.isFinal
1381
+ });
1382
+ }
1383
+
1384
+ getMiddlewares(operationRoute) {
1385
+ const {
1386
+ endpoint
1387
+ } = operationRoute;
1436
1388
  const {
1437
1389
  beforeMiddlewares,
1438
1390
  middlewares: mldwrs,
1439
- afterMiddlewares,
1440
- operation
1391
+ afterMiddlewares
1441
1392
  } = endpoint;
1442
1393
  const {
1443
1394
  middlewares: {
@@ -1445,35 +1396,15 @@ class PlatformControllerBuilder {
1445
1396
  useAfter
1446
1397
  }
1447
1398
  } = this.provider;
1448
- const router = this.provider.getRouter(); // Endpoint lifecycle
1449
-
1450
- let handlers = [];
1451
- const hasFiles = [...endpoint.children.values()].find(item => item.paramType === ParamTypes.FILES);
1452
- handlers = handlers.concat(useCtxHandler(bindEndpointMiddleware(endpoint))).concat(PlatformAcceptMimesMiddleware).concat(hasFiles && PlatformMulterMiddleware).concat(beforeMiddlewares) // Endpoint before-middlewares
1399
+ const hasFiles = [...operationRoute.endpoint.children.values()].find(item => item.paramType === ParamTypes.FILES);
1400
+ return [].concat(useCtxHandler(bindEndpointMiddleware(endpoint))).concat(PlatformAcceptMimesMiddleware).concat(hasFiles && PlatformMulterMiddleware).concat(beforeMiddlewares) // Endpoint before-middlewares
1453
1401
  .concat(use) // Controller use-middlewares
1454
1402
  // .concat(endpoint.cache && PlatformCacheMiddleware)
1455
1403
  .concat(mldwrs) // Endpoint middlewares
1456
1404
  .concat(endpoint) // Endpoint metadata
1457
1405
  .concat(afterMiddlewares) // Endpoint after-middlewares
1458
1406
  .concat(useAfter) // Controller after middlewares (equivalent to afterEach)
1459
- .filter(item => !!item); // Add handlers to the router
1460
-
1461
- operation == null ? void 0 : operation.operationPaths.forEach(({
1462
- path,
1463
- method,
1464
- isFinal
1465
- }) => {
1466
- router.addRoute({
1467
- method: formatMethod(method),
1468
- path,
1469
- handlers,
1470
- isFinal
1471
- });
1472
- });
1473
-
1474
- if (!(operation != null && operation.operationPaths.size)) {
1475
- router.use(...handlers);
1476
- }
1407
+ .filter(item => !!item);
1477
1408
  }
1478
1409
 
1479
1410
  buildChildrenCtrls(injector) {
@@ -2078,18 +2009,14 @@ class PlatformContext extends DIContext {
2078
2009
 
2079
2010
  }
2080
2011
 
2081
- class PlatformRouteDetails {
2082
- constructor({
2083
- provider,
2084
- endpoint,
2085
- method,
2086
- url
2087
- }) {
2088
- this.provider = provider;
2089
- this.endpoint = endpoint;
2090
- this.method = method;
2091
- this.url = url;
2092
- this.rawBody = !!endpoint.params.find(param => param.paramType === ParamTypes.RAW_BODY);
2012
+ class PlatformRouteDetails extends JsonOperationRoute {
2013
+ constructor(options = {}) {
2014
+ super(options);
2015
+ this.rawBody = !!this.endpoint.params.find(param => param.paramType === ParamTypes.RAW_BODY);
2016
+ }
2017
+
2018
+ get url() {
2019
+ return this.fullPath;
2093
2020
  }
2094
2021
 
2095
2022
  get name() {
@@ -2128,37 +2055,6 @@ class ControllerProvider extends Provider {
2128
2055
  constructor(provide, options = {}) {
2129
2056
  super(provide, options);
2130
2057
  this.type = ProviderType.CONTROLLER;
2131
- this.entity = JsonEntityStore.from(provide);
2132
- }
2133
-
2134
- get path() {
2135
- return this.entity.path;
2136
- }
2137
-
2138
- set path(path) {
2139
- this.entity.path = path;
2140
- }
2141
- /**
2142
- *
2143
- * @returns {EndpointMetadata[]}
2144
- */
2145
-
2146
-
2147
- get endpoints() {
2148
- return EndpointMetadata.getEndpoints(this.provide);
2149
- }
2150
-
2151
- get children() {
2152
- return this.store.get("childrenControllers", []);
2153
- }
2154
- /**
2155
- *
2156
- * @returns {ControllerProvider}
2157
- */
2158
-
2159
-
2160
- get parent() {
2161
- return this.store.get("parentController");
2162
2058
  }
2163
2059
  /**
2164
2060
  *
@@ -2206,24 +2102,6 @@ class ControllerProvider extends Provider {
2206
2102
  });
2207
2103
  this.store.set("middlewares", mdlwrs);
2208
2104
  }
2209
- /**
2210
- *
2211
- * @returns {boolean}
2212
- */
2213
-
2214
-
2215
- hasChildren() {
2216
- return !!this.children.length;
2217
- }
2218
- /**
2219
- *
2220
- * @returns {boolean}
2221
- */
2222
-
2223
-
2224
- hasParent() {
2225
- return !!this.store.get("parentController");
2226
- }
2227
2105
 
2228
2106
  getRouter() {
2229
2107
  return this.router;
@@ -2252,9 +2130,12 @@ let PropertyMetadata = class PropertyMetadata extends JsonEntityStore {
2252
2130
  };
2253
2131
  PropertyMetadata = __decorate([JsonEntityComponent(DecoratorTypes.PROP)], PropertyMetadata);
2254
2132
 
2255
- function getControllerPath(basePath, provider) {
2256
- return (basePath === provider.path ? provider.path : (basePath || "") + provider.path).replace(/\/\//gi, "/");
2257
- }
2133
+ GlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider, {
2134
+ onInvoke(provider, locals) {
2135
+ locals.set(PlatformRouter, provider.getRouter());
2136
+ }
2137
+
2138
+ });
2258
2139
 
2259
2140
  /**
2260
2141
  * `Platform` is used to provide all routes collected by annotation `@Controller`.
@@ -2279,42 +2160,44 @@ let Platform = class Platform {
2279
2160
  return this._routes;
2280
2161
  }
2281
2162
 
2282
- $onInit() {
2283
- this.buildControllers();
2284
- }
2285
-
2286
2163
  addRoutes(routes) {
2287
2164
  routes.forEach(routeSettings => {
2288
2165
  this.addRoute(routeSettings.route, routeSettings.token);
2289
2166
  });
2290
2167
  }
2291
2168
 
2292
- addRoute(endpoint, token) {
2169
+ addRoute(basePath, token) {
2293
2170
  const {
2294
2171
  injector
2295
2172
  } = this;
2173
+ const provider = injector.getProvider(token);
2296
2174
 
2297
- if (injector.hasProvider(token)) {
2298
- const provider = injector.getProvider(token);
2299
-
2300
- if (provider.type === ProviderType.CONTROLLER) {
2301
- const route = getControllerPath(endpoint, provider);
2302
-
2303
- if (!provider.hasParent()) {
2304
- const routes = this.buildRoutes(route, provider);
2175
+ if (!provider || provider.hasParent()) {
2176
+ return;
2177
+ }
2305
2178
 
2306
- this._routes.push(...routes);
2179
+ const ctrlPath = concatPath(basePath, JsonEntityStore.from(provider.token).path);
2307
2180
 
2308
- this._controllers.push({
2309
- route,
2310
- provider
2311
- });
2181
+ this._controllers.push({
2182
+ route: ctrlPath,
2183
+ provider
2184
+ });
2312
2185
 
2313
- this.app.use(route, ...[].concat(provider.getRouter().callback()));
2314
- }
2186
+ this.app.use(ctrlPath, ...[].concat(provider.getRouter().callback()));
2187
+ this._routes = getOperationsRoutes(provider.token, {
2188
+ withChildren: true,
2189
+ basePath
2190
+ }).reduce((routes, operationRoute) => {
2191
+ if (injector.hasProvider(token)) {
2192
+ const provider = injector.getProvider(operationRoute.token);
2193
+ const route = new PlatformRouteDetails(_extends({}, operationRoute, {
2194
+ provider
2195
+ }));
2196
+ return routes.concat(route);
2315
2197
  }
2316
- }
2317
2198
 
2199
+ return routes;
2200
+ }, this._routes);
2318
2201
  return this;
2319
2202
  }
2320
2203
  /**
@@ -2330,6 +2213,10 @@ let Platform = class Platform {
2330
2213
  getMountedControllers() {
2331
2214
  return this._controllers;
2332
2215
  }
2216
+
2217
+ $onInit() {
2218
+ this.buildControllers();
2219
+ }
2333
2220
  /**
2334
2221
  * Create routers from the collected controllers.
2335
2222
  * @private
@@ -2360,38 +2247,6 @@ let Platform = class Platform {
2360
2247
  }
2361
2248
  });
2362
2249
  }
2363
- /**
2364
- *
2365
- * @param ctrl
2366
- * @param endpointUrl
2367
- */
2368
-
2369
-
2370
- buildRoutes(endpointUrl, ctrl) {
2371
- const {
2372
- injector
2373
- } = this;
2374
- let routes = [];
2375
- routes = ctrl.children.map(ctrl => injector.getProvider(ctrl)).reduce((routes, provider) => {
2376
- return routes.concat(this.buildRoutes(`${endpointUrl}${provider.path}`, provider));
2377
- }, routes);
2378
- ctrl.endpoints.forEach(endpoint => {
2379
- endpoint.operationPaths.forEach(({
2380
- path,
2381
- method
2382
- }) => {
2383
- if (method) {
2384
- routes.push(new PlatformRouteDetails({
2385
- provider: ctrl,
2386
- endpoint,
2387
- method,
2388
- url: `${endpointUrl}${path || ""}`.replace(/\/\//gi, "/")
2389
- }));
2390
- }
2391
- });
2392
- });
2393
- return routes;
2394
- }
2395
2250
 
2396
2251
  };
2397
2252
  Platform = __decorate([Injectable({
@@ -2670,7 +2525,6 @@ function getStaticsOptions(statics) {
2670
2525
  }, []);
2671
2526
  }
2672
2527
 
2673
- const SKIP_HOOKS = ["$beforeInit", "$afterInit", "$onInit", "$onMountingMiddlewares"];
2674
2528
  const {
2675
2529
  bind,
2676
2530
  start,
@@ -2681,26 +2535,26 @@ const {
2681
2535
  * @platform
2682
2536
  */
2683
2537
 
2684
- var _rootModule = /*#__PURE__*/_classPrivateFieldLooseKey("rootModule");
2685
-
2686
2538
  var _injector = /*#__PURE__*/_classPrivateFieldLooseKey("injector");
2687
2539
 
2688
2540
  var _providers = /*#__PURE__*/_classPrivateFieldLooseKey("providers");
2689
2541
 
2542
+ var _rootModule = /*#__PURE__*/_classPrivateFieldLooseKey("rootModule");
2543
+
2690
2544
  class PlatformBuilder {
2691
2545
  constructor({
2692
2546
  name,
2693
2547
  providers
2694
2548
  }) {
2695
- Object.defineProperty(this, _rootModule, {
2549
+ Object.defineProperty(this, _injector, {
2696
2550
  writable: true,
2697
2551
  value: void 0
2698
2552
  });
2699
- Object.defineProperty(this, _injector, {
2553
+ Object.defineProperty(this, _providers, {
2700
2554
  writable: true,
2701
2555
  value: void 0
2702
2556
  });
2703
- Object.defineProperty(this, _providers, {
2557
+ Object.defineProperty(this, _rootModule, {
2704
2558
  writable: true,
2705
2559
  value: void 0
2706
2560
  });
@@ -2717,7 +2571,7 @@ class PlatformBuilder {
2717
2571
  }
2718
2572
 
2719
2573
  get rootModule() {
2720
- return _classPrivateFieldLooseBase(this, _rootModule)[_rootModule];
2574
+ return _classPrivateFieldLooseBase(this, _injector)[_injector].get(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule]);
2721
2575
  }
2722
2576
 
2723
2577
  get app() {
@@ -2824,9 +2678,12 @@ class PlatformBuilder {
2824
2678
  const {
2825
2679
  injector
2826
2680
  } = this;
2827
- await this.callHook("$beforeInit");
2828
2681
  this.log("Build providers");
2829
- const container = createContainer(constructorOf(this.rootModule));
2682
+ const container = createContainer();
2683
+ container.addProvider(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule], {
2684
+ type: "server:module",
2685
+ scope: ProviderScope.SINGLETON
2686
+ });
2830
2687
  await injector.load(container);
2831
2688
  this.log("Settings and injector loaded");
2832
2689
  await this.callHook("$afterInit");
@@ -2856,26 +2713,18 @@ class PlatformBuilder {
2856
2713
 
2857
2714
  async callHook(hook, ...args) {
2858
2715
  const {
2859
- injector,
2860
- rootModule
2716
+ injector
2861
2717
  } = this;
2862
2718
  log(hook);
2863
2719
 
2864
2720
  if (!this.disableBootstrapLog) {
2865
2721
  injector.logger.info(`\x1B[1mCall hook ${hook}\x1B[22m`);
2866
- } // call hook for the Server
2867
-
2868
-
2869
- if (hook in rootModule) {
2870
- await rootModule[hook](...args);
2871
2722
  } // Load middlewares for the given hook
2872
2723
 
2873
2724
 
2874
2725
  this.loadMiddlewaresFor(hook); // call hooks added by providers
2875
2726
 
2876
- if (!SKIP_HOOKS.includes(hook)) {
2877
- await injector.emit(hook);
2878
- }
2727
+ await injector.emit(hook);
2879
2728
  }
2880
2729
 
2881
2730
  async loadStatics(hook) {
@@ -2945,7 +2794,6 @@ class PlatformBuilder {
2945
2794
  this.createInjector(module, _extends({}, settings, {
2946
2795
  PLATFORM_NAME: this.name
2947
2796
  }));
2948
- this.createRootModule(module);
2949
2797
  await this.runLifecycle();
2950
2798
  return this;
2951
2799
  }
@@ -2994,6 +2842,7 @@ class PlatformBuilder {
2994
2842
  }
2995
2843
 
2996
2844
  createInjector(module, settings) {
2845
+ _classPrivateFieldLooseBase(this, _rootModule)[_rootModule] = module;
2997
2846
  const configuration = getConfiguration(module, settings);
2998
2847
  _classPrivateFieldLooseBase(this, _injector)[_injector] = createInjector(configuration); // configure locals providers
2999
2848
 
@@ -3005,12 +2854,6 @@ class PlatformBuilder {
3005
2854
  createHttpServer(this.injector);
3006
2855
  }
3007
2856
 
3008
- createRootModule(module) {
3009
- _classPrivateFieldLooseBase(this, _rootModule)[_rootModule] = this.injector.invoke(module);
3010
- this.injector.delete(constructorOf(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule]));
3011
- this.injector.delete(classOf(_classPrivateFieldLooseBase(this, _rootModule)[_rootModule]));
3012
- }
3013
-
3014
2857
  }
3015
2858
 
3016
2859
  /**
@@ -3167,16 +3010,6 @@ function MultipartFile(name, maxCount) {
3167
3010
  };
3168
3011
  }
3169
3012
 
3170
- /**
3171
- *
3172
- * @param fn
3173
- * @decorator
3174
- */
3175
-
3176
- function EndpointFn(fn) {
3177
- return JsonEntityFn(fn);
3178
- }
3179
-
3180
3013
  /**
3181
3014
  * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.
3182
3015
  *
@@ -3197,9 +3030,18 @@ function EndpointFn(fn) {
3197
3030
  */
3198
3031
 
3199
3032
  function AcceptMime(...mimes) {
3200
- return useDecorators(Produces(...mimes), EndpointFn(endpoint => {
3201
- endpoint.acceptMimes = mimes;
3202
- }));
3033
+ return useDecorators(Produces(...mimes), StoreSet("acceptMimes", mimes));
3034
+ }
3035
+
3036
+ /**
3037
+ *
3038
+ * @param fn
3039
+ * @decorator
3040
+ * @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.
3041
+ */
3042
+
3043
+ function EndpointFn(fn) {
3044
+ return JsonEntityFn(fn);
3203
3045
  }
3204
3046
 
3205
3047
  /**
@@ -3572,13 +3414,6 @@ class PlatformTest extends DITest {
3572
3414
 
3573
3415
  }
3574
3416
 
3575
- GlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider, {
3576
- onInvoke(provider, locals) {
3577
- locals.set(PlatformRouter, provider.getRouter());
3578
- }
3579
-
3580
- });
3581
-
3582
3417
  /**
3583
3418
  * @ignore
3584
3419
  * @deprecated Will be removed in v7