@tsed/common 6.80.1 → 6.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { Type } from "@tsed/core";
2
2
  import { ParamMetadata } from "@tsed/platform-params";
3
- import { JsonEntityStore, JsonEntityStoreOptions, JsonOperation } from "@tsed/schema";
3
+ import { JsonEntityStoreOptions, JsonMethodStore, JsonOperation } from "@tsed/schema";
4
4
  export interface EndpointConstructorOptions extends JsonEntityStoreOptions {
5
5
  beforeMiddlewares?: Function[];
6
6
  middlewares?: Function[];
@@ -30,18 +30,13 @@ export interface EndpointRedirectOptions {
30
30
  * }
31
31
  *
32
32
  */
33
- export declare class EndpointMetadata extends JsonEntityStore implements EndpointConstructorOptions {
33
+ export declare class EndpointMetadata extends JsonMethodStore implements EndpointConstructorOptions {
34
34
  beforeMiddlewares: any[];
35
35
  middlewares: any[];
36
36
  afterMiddlewares: any[];
37
37
  constructor(options: EndpointConstructorOptions);
38
38
  get targetName(): string;
39
39
  get params(): ParamMetadata[];
40
- /**
41
- * Return the JsonOperation
42
- */
43
- get operation(): JsonOperation;
44
- get operationPaths(): Map<string, import("@tsed/schema").JsonMethodPath>;
45
40
  get view(): EndpointViewOptions;
46
41
  set view(view: EndpointViewOptions);
47
42
  get acceptMimes(): string[];
@@ -1,6 +1,6 @@
1
1
  import { Type } from "@tsed/core";
2
2
  import { ProviderScope } from "@tsed/di";
3
- import { ParamMetadata } from "@tsed/platform-params";
3
+ import { JsonParameterStore } from "@tsed/schema";
4
4
  import { HandlerType } from "../interfaces/HandlerType";
5
5
  import { PlatformRouteOptions, PlatformRouteWithoutHandlers } from "../interfaces/PlatformRouteOptions";
6
6
  export interface HandlerMetadataOptions {
@@ -25,7 +25,7 @@ export declare class HandlerMetadata {
25
25
  handler: any;
26
26
  constructor(options: HandlerMetadataOptions);
27
27
  get hasErrorParam(): boolean;
28
- getParams(): ParamMetadata[];
28
+ getParams(): JsonParameterStore[];
29
29
  hasParamType(paramType: any): boolean;
30
30
  isFinal(): boolean;
31
31
  toString(): string;
@@ -1,6 +1,6 @@
1
+ import { JsonOperationRoute } from "@tsed/schema";
1
2
  import { EndpointMetadata } from "./EndpointMetadata";
2
3
  import { ControllerProvider } from "./ControllerProvider";
3
- import { JsonOperationRoute } from "@tsed/schema";
4
4
  export interface PlatformRouterDetailsOptions {
5
5
  provider: ControllerProvider;
6
6
  endpoint: EndpointMetadata;
@@ -11,18 +11,13 @@ export declare class PlatformRouteDetails extends JsonOperationRoute<EndpointMet
11
11
  readonly rawBody: boolean;
12
12
  readonly provider: ControllerProvider;
13
13
  constructor(options?: Partial<PlatformRouteDetails>);
14
- get url(): string;
15
- get name(): string;
16
- get className(): string;
17
- get methodClassName(): string;
18
- get parameters(): import("@tsed/platform-params").ParamMetadata[];
19
14
  toJSON(): {
20
15
  method: string;
21
16
  name: string;
22
17
  url: string;
23
18
  className: string;
24
19
  methodClassName: string;
25
- parameters: import("@tsed/platform-params").ParamMetadata[];
20
+ parameters: any;
26
21
  rawBody: boolean;
27
22
  };
28
23
  }
@@ -1,11 +1,17 @@
1
1
  import { Type } from "@tsed/core";
2
- import { JsonEntityStore } from "@tsed/schema";
3
- export declare class PropertyMetadata extends JsonEntityStore {
2
+ import { JsonPropertyStore } from "@tsed/schema";
3
+ /**
4
+ * @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
5
+ */
6
+ export declare class PropertyMetadata extends JsonPropertyStore {
7
+ /**
8
+ * @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
9
+ */
4
10
  static get(target: Type<any>, propertyKey: string | symbol): PropertyMetadata;
5
11
  /**
6
12
  * @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
7
13
  */
8
14
  static getProperties(target: Type<any>, options?: Partial<{
9
15
  withIgnoredProps: boolean;
10
- }>): Map<string | number | symbol, JsonEntityStore>;
16
+ }>): Map<string | number | symbol, JsonPropertyStore>;
11
17
  }
package/lib/index.js CHANGED
@@ -471,7 +471,7 @@ class HandlerMetadata {
471
471
  this.type = exports.HandlerType.ERR_MIDDLEWARE;
472
472
  }
473
473
 
474
- this.injectable = platformParams.ParamMetadata.getParams(target, propertyKey).length > 0;
474
+ this.injectable = schema.JsonParameterStore.getParams(target, propertyKey).length > 0;
475
475
  } else {
476
476
  this.handler = handler;
477
477
  }
@@ -490,7 +490,7 @@ class HandlerMetadata {
490
490
  }
491
491
 
492
492
  getParams() {
493
- return platformParams.ParamMetadata.getParams(this.target, this.propertyKey) || [];
493
+ return schema.JsonParameterStore.getParams(this.target, this.propertyKey) || [];
494
494
  }
495
495
 
496
496
  hasParamType(paramType) {
@@ -526,7 +526,7 @@ class HandlerMetadata {
526
526
  *
527
527
  */
528
528
 
529
- exports.EndpointMetadata = class EndpointMetadata extends schema.JsonEntityStore {
529
+ exports.EndpointMetadata = class EndpointMetadata extends schema.JsonMethodStore {
530
530
  constructor(options) {
531
531
  super(_extends({
532
532
  store: core.Store.fromMethod(options.target, options.propertyKey),
@@ -550,19 +550,7 @@ exports.EndpointMetadata = class EndpointMetadata extends schema.JsonEntityStore
550
550
  }
551
551
 
552
552
  get params() {
553
- return Array.from(this.children.values());
554
- }
555
- /**
556
- * Return the JsonOperation
557
- */
558
-
559
-
560
- get operation() {
561
- return this._operation;
562
- }
563
-
564
- get operationPaths() {
565
- return this.operation.operationPaths;
553
+ return this.parameters;
566
554
  }
567
555
 
568
556
  get view() {
@@ -2021,27 +2009,7 @@ class PlatformContext extends di.DIContext {
2021
2009
  class PlatformRouteDetails extends schema.JsonOperationRoute {
2022
2010
  constructor(options = {}) {
2023
2011
  super(options);
2024
- this.rawBody = !!this.endpoint.params.find(param => param.paramType === platformParams.ParamTypes.RAW_BODY);
2025
- }
2026
-
2027
- get url() {
2028
- return this.fullPath;
2029
- }
2030
-
2031
- get name() {
2032
- return `${this.endpoint.targetName}.${this.methodClassName}()`;
2033
- }
2034
-
2035
- get className() {
2036
- return this.endpoint.targetName;
2037
- }
2038
-
2039
- get methodClassName() {
2040
- return String(this.endpoint.propertyKey);
2041
- }
2042
-
2043
- get parameters() {
2044
- return this.endpoint.params;
2012
+ this.rawBody = !!this.endpoint.parameters.find(param => param.paramType === platformParams.ParamTypes.RAW_BODY);
2045
2013
  }
2046
2014
 
2047
2015
  toJSON() {
@@ -2123,7 +2091,14 @@ class ControllerProvider extends di.Provider {
2123
2091
 
2124
2092
  }
2125
2093
 
2126
- exports.PropertyMetadata = class PropertyMetadata extends schema.JsonEntityStore {
2094
+ /**
2095
+ * @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
2096
+ */
2097
+
2098
+ exports.PropertyMetadata = class PropertyMetadata extends schema.JsonPropertyStore {
2099
+ /**
2100
+ * @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
2101
+ */
2127
2102
  static get(target, propertyKey) {
2128
2103
  return schema.JsonEntityStore.from(core.prototypeOf(target), propertyKey);
2129
2104
  }