@tsed/common 6.80.1 → 6.84.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.
- package/lib/domain/EndpointMetadata.d.ts +2 -7
- package/lib/domain/HandlerMetadata.d.ts +2 -2
- package/lib/domain/PlatformRouteDetails.d.ts +2 -7
- package/lib/domain/PropertyMetadata.d.ts +9 -3
- package/lib/index.js +13 -38
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +15 -40
- package/lib/index.modern.js.map +1 -1
- package/package.json +15 -15
package/lib/index.modern.js
CHANGED
|
@@ -3,7 +3,7 @@ export { $log, Logger } from '@tsed/logger';
|
|
|
3
3
|
import '@tsed/logger-file';
|
|
4
4
|
import { DIConfiguration, ProviderType, ProviderScope, Injectable, Inject, InjectorService, Constant, Scope, DIContext, Provider, GlobalProviders, setLoggerLevel, registerProvider, Configuration, createContainer, Container, getConfiguration, DITest } from '@tsed/di';
|
|
5
5
|
export * from '@tsed/di';
|
|
6
|
-
import { ParamTypes,
|
|
6
|
+
import { ParamTypes, PlatformParams, Context, UseParam, mapParamsOptions } from '@tsed/platform-params';
|
|
7
7
|
export * from '@tsed/platform-params';
|
|
8
8
|
export * from '@tsed/platform-exceptions';
|
|
9
9
|
import { PlatformResponseFilter } from '@tsed/platform-response-filter';
|
|
@@ -20,7 +20,7 @@ import { __decorate, __metadata, __param } from 'tslib';
|
|
|
20
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';
|
|
21
21
|
import { PerfLogger } from '@tsed/perf';
|
|
22
22
|
import { Exception, NotAcceptable } from '@tsed/exceptions';
|
|
23
|
-
import { JsonEntityStore, JsonEntityComponent, getOperationsRoutes, OperationMethods, JsonOperationRoute, getProperties, concatPath, Returns, Consumes, Produces, JsonEntityFn } from '@tsed/schema';
|
|
23
|
+
import { JsonParameterStore, JsonMethodStore, JsonEntityStore, JsonEntityComponent, getOperationsRoutes, OperationMethods, JsonOperationRoute, JsonPropertyStore, getProperties, concatPath, Returns, Consumes, Produces, JsonEntityFn } from '@tsed/schema';
|
|
24
24
|
export { All, Delete, Get, Head, Location, Options, Patch, Post, Put, Redirect } from '@tsed/schema';
|
|
25
25
|
import { promisify } from 'util';
|
|
26
26
|
import Http, { ServerResponse, IncomingMessage } from 'http';
|
|
@@ -454,7 +454,7 @@ class HandlerMetadata {
|
|
|
454
454
|
this.type = HandlerType.ERR_MIDDLEWARE;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
this.injectable =
|
|
457
|
+
this.injectable = JsonParameterStore.getParams(target, propertyKey).length > 0;
|
|
458
458
|
} else {
|
|
459
459
|
this.handler = handler;
|
|
460
460
|
}
|
|
@@ -473,7 +473,7 @@ class HandlerMetadata {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
getParams() {
|
|
476
|
-
return
|
|
476
|
+
return JsonParameterStore.getParams(this.target, this.propertyKey) || [];
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
hasParamType(paramType) {
|
|
@@ -509,7 +509,7 @@ class HandlerMetadata {
|
|
|
509
509
|
*
|
|
510
510
|
*/
|
|
511
511
|
|
|
512
|
-
let EndpointMetadata = class EndpointMetadata extends
|
|
512
|
+
let EndpointMetadata = class EndpointMetadata extends JsonMethodStore {
|
|
513
513
|
constructor(options) {
|
|
514
514
|
super(_extends({
|
|
515
515
|
store: Store.fromMethod(options.target, options.propertyKey),
|
|
@@ -533,19 +533,7 @@ let EndpointMetadata = class EndpointMetadata extends JsonEntityStore {
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
get params() {
|
|
536
|
-
return
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Return the JsonOperation
|
|
540
|
-
*/
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
get operation() {
|
|
544
|
-
return this._operation;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
get operationPaths() {
|
|
548
|
-
return this.operation.operationPaths;
|
|
536
|
+
return this.parameters;
|
|
549
537
|
}
|
|
550
538
|
|
|
551
539
|
get view() {
|
|
@@ -2012,27 +2000,7 @@ class PlatformContext extends DIContext {
|
|
|
2012
2000
|
class PlatformRouteDetails extends JsonOperationRoute {
|
|
2013
2001
|
constructor(options = {}) {
|
|
2014
2002
|
super(options);
|
|
2015
|
-
this.rawBody = !!this.endpoint.
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
get url() {
|
|
2019
|
-
return this.fullPath;
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
get name() {
|
|
2023
|
-
return `${this.endpoint.targetName}.${this.methodClassName}()`;
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
get className() {
|
|
2027
|
-
return this.endpoint.targetName;
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
get methodClassName() {
|
|
2031
|
-
return String(this.endpoint.propertyKey);
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
get parameters() {
|
|
2035
|
-
return this.endpoint.params;
|
|
2003
|
+
this.rawBody = !!this.endpoint.parameters.find(param => param.paramType === ParamTypes.RAW_BODY);
|
|
2036
2004
|
}
|
|
2037
2005
|
|
|
2038
2006
|
toJSON() {
|
|
@@ -2114,7 +2082,14 @@ class ControllerProvider extends Provider {
|
|
|
2114
2082
|
|
|
2115
2083
|
}
|
|
2116
2084
|
|
|
2117
|
-
|
|
2085
|
+
/**
|
|
2086
|
+
* @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
|
|
2087
|
+
*/
|
|
2088
|
+
|
|
2089
|
+
let PropertyMetadata = class PropertyMetadata extends JsonPropertyStore {
|
|
2090
|
+
/**
|
|
2091
|
+
* @deprecated Since 2020-11-11. Use getProperties from @tsed/schema
|
|
2092
|
+
*/
|
|
2118
2093
|
static get(target, propertyKey) {
|
|
2119
2094
|
return JsonEntityStore.from(prototypeOf(target), propertyKey);
|
|
2120
2095
|
}
|