@tsed/platform-params 6.96.1 → 6.97.2

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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UseParam = void 0;
4
4
  const core_1 = require("@tsed/core");
5
5
  const schema_1 = require("@tsed/schema");
6
+ const ParamTypes_1 = require("../domain/ParamTypes");
6
7
  const paramFn_1 = require("./paramFn");
7
8
  const useDeserialization_1 = require("./useDeserialization");
8
9
  const useParamType_1 = require("./useParamType");
@@ -18,7 +19,7 @@ function mapPipes(options) {
18
19
  useType
19
20
  ? (0, useType_1.UseType)(useType)
20
21
  : (0, paramFn_1.ParamFn)((entity, parameters) => {
21
- if (entity.isCollection && entity.type === Object) {
22
+ if (entity.isCollection && entity.type === Object && paramType !== ParamTypes_1.ParamTypes.FILES) {
22
23
  (0, schema_1.Any)()(...parameters);
23
24
  }
24
25
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"useParam.js","sourceRoot":"","sources":["../../../src/decorators/useParam.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAuC;AAEvC,uCAAkC;AAClC,6DAAwD;AAExD,iDAA4C;AAC5C,uCAAkC;AAClC,mDAA8C;AAE9C;;;GAGG;AACH,SAAS,QAAQ,CAAC,OAA8B;IAC9C,MAAM,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,KAAK,EAAC,GAAG,OAAO,CAAC;IAExF,OAAO;QACL,OAAO;YACL,CAAC,CAAC,IAAA,iBAAO,EAAC,OAAO,CAAC;YAClB,CAAC,CAAC,IAAA,iBAAO,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;gBAC7B,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE;oBACjD,IAAA,YAAG,GAAE,CAAC,GAAG,UAAU,CAAC,CAAC;iBACtB;YACH,CAAC,CAAC;QACN,aAAa,IAAI,IAAA,6BAAa,GAAE;QAChC,YAAY,IAAI,IAAA,uCAAkB,EAAC,KAAK,CAAC;KAC1C,CAAC;AACJ,CAAC;AAuBD,SAAgB,QAAQ,CAAC,GAAG,IAAW;IACrC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE,MAAM;QAChB,GAAG,CAAC,CAAC,IAAA,eAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClD,SAAS,EAAE,IAAA,eAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;KAC3D,CAAC;IAEF,OAAO,IAAA,oBAAa,EAAC,IAAA,2BAAY,EAAC,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAuB,CAAC;AAC1F,CAAC;AARD,4BAQC","sourcesContent":["import {isString, useDecorators} from \"@tsed/core\";\nimport {Any, Name} from \"@tsed/schema\";\nimport {ParamOptions} from \"../domain/ParamOptions\";\nimport {ParamFn} from \"./paramFn\";\nimport {UseDeserialization} from \"./useDeserialization\";\nimport {UseParamExpression} from \"./useParamExpression\";\nimport {UseParamType} from \"./useParamType\";\nimport {UseType} from \"./useType\";\nimport {UseValidation} from \"./useValidation\";\n\n/**\n * @ignore\n * @param options\n */\nfunction mapPipes(options: Partial<ParamOptions>) {\n const {paramType, useType, expression, useValidation, useConverter, ...props} = options;\n\n return [\n useType\n ? UseType(useType)\n : ParamFn((entity, parameters) => {\n if (entity.isCollection && entity.type === Object) {\n Any()(...parameters);\n }\n }),\n useValidation && UseValidation(),\n useConverter && UseDeserialization(props)\n ];\n}\n\n/**\n * Register a new param. It use the paramType to extract value and give it to the next pipe.\n *\n * Given options allow to enable or disable following pipes:\n *\n * - useType: Add extra type for the json mapper,\n * - expression: Get property from the returned value by the previous pipe.\n * - useValidation: Apply validation from the returned value by the previous pipe.\n * - useConverter: Apply json mapper from the returned value by the previous pipe.\n *\n * @param options\n * @decorator\n * @operation\n * @input\n * @pipe\n */\nexport function UseParam(options: Partial<ParamOptions>): ParameterDecorator;\n/**\n * @deprecated Since v6\n */\nexport function UseParam(paramType: string, options?: Partial<ParamOptions>): ParameterDecorator;\nexport function UseParam(...args: any[]): ParameterDecorator {\n const options = {\n dataPath: \"$ctx\",\n ...((isString(args[0]) ? args[1] : args[0]) || {}),\n paramType: isString(args[0]) ? args[0] : args[0].paramType\n };\n\n return useDecorators(UseParamType(options), ...mapPipes(options)) as ParameterDecorator;\n}\n"]}
1
+ {"version":3,"file":"useParam.js","sourceRoot":"","sources":["../../../src/decorators/useParam.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAiC;AAEjC,qDAAgD;AAChD,uCAAkC;AAClC,6DAAwD;AACxD,iDAA4C;AAC5C,uCAAkC;AAClC,mDAA8C;AAE9C;;;GAGG;AACH,SAAS,QAAQ,CAAC,OAA8B;IAC9C,MAAM,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,KAAK,EAAC,GAAG,OAAO,CAAC;IAExF,OAAO;QACL,OAAO;YACL,CAAC,CAAC,IAAA,iBAAO,EAAC,OAAO,CAAC;YAClB,CAAC,CAAC,IAAA,iBAAO,EAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;gBAC7B,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,SAAS,KAAK,uBAAU,CAAC,KAAK,EAAE;oBACnF,IAAA,YAAG,GAAE,CAAC,GAAG,UAAU,CAAC,CAAC;iBACtB;YACH,CAAC,CAAC;QACN,aAAa,IAAI,IAAA,6BAAa,GAAE;QAChC,YAAY,IAAI,IAAA,uCAAkB,EAAC,KAAK,CAAC;KAC1C,CAAC;AACJ,CAAC;AAuBD,SAAgB,QAAQ,CAAC,GAAG,IAAW;IACrC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE,MAAM;QAChB,GAAG,CAAC,CAAC,IAAA,eAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClD,SAAS,EAAE,IAAA,eAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;KAC3D,CAAC;IAEF,OAAO,IAAA,oBAAa,EAAC,IAAA,2BAAY,EAAC,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAuB,CAAC;AAC1F,CAAC;AARD,4BAQC","sourcesContent":["import {isString, useDecorators} from \"@tsed/core\";\nimport {Any} from \"@tsed/schema\";\nimport {ParamOptions} from \"../domain/ParamOptions\";\nimport {ParamTypes} from \"../domain/ParamTypes\";\nimport {ParamFn} from \"./paramFn\";\nimport {UseDeserialization} from \"./useDeserialization\";\nimport {UseParamType} from \"./useParamType\";\nimport {UseType} from \"./useType\";\nimport {UseValidation} from \"./useValidation\";\n\n/**\n * @ignore\n * @param options\n */\nfunction mapPipes(options: Partial<ParamOptions>) {\n const {paramType, useType, expression, useValidation, useConverter, ...props} = options;\n\n return [\n useType\n ? UseType(useType)\n : ParamFn((entity, parameters) => {\n if (entity.isCollection && entity.type === Object && paramType !== ParamTypes.FILES) {\n Any()(...parameters);\n }\n }),\n useValidation && UseValidation(),\n useConverter && UseDeserialization(props)\n ];\n}\n\n/**\n * Register a new param. It use the paramType to extract value and give it to the next pipe.\n *\n * Given options allow to enable or disable following pipes:\n *\n * - useType: Add extra type for the json mapper,\n * - expression: Get property from the returned value by the previous pipe.\n * - useValidation: Apply validation from the returned value by the previous pipe.\n * - useConverter: Apply json mapper from the returned value by the previous pipe.\n *\n * @param options\n * @decorator\n * @operation\n * @input\n * @pipe\n */\nexport function UseParam(options: Partial<ParamOptions>): ParameterDecorator;\n/**\n * @deprecated Since v6\n */\nexport function UseParam(paramType: string, options?: Partial<ParamOptions>): ParameterDecorator;\nexport function UseParam(...args: any[]): ParameterDecorator {\n const options = {\n dataPath: \"$ctx\",\n ...((isString(args[0]) ? args[1] : args[0]) || {}),\n paramType: isString(args[0]) ? args[0] : args[0].paramType\n };\n\n return useDecorators(UseParamType(options), ...mapPipes(options)) as ParameterDecorator;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { isString, useDecorators } from "@tsed/core";
2
2
  import { Any } from "@tsed/schema";
3
+ import { ParamTypes } from "../domain/ParamTypes";
3
4
  import { ParamFn } from "./paramFn";
4
5
  import { UseDeserialization } from "./useDeserialization";
5
6
  import { UseParamType } from "./useParamType";
@@ -15,7 +16,7 @@ function mapPipes(options) {
15
16
  useType
16
17
  ? UseType(useType)
17
18
  : ParamFn((entity, parameters) => {
18
- if (entity.isCollection && entity.type === Object) {
19
+ if (entity.isCollection && entity.type === Object && paramType !== ParamTypes.FILES) {
19
20
  Any()(...parameters);
20
21
  }
21
22
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"useParam.js","sourceRoot":"","sources":["../../../src/decorators/useParam.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,GAAG,EAAO,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OA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\nimport {ParamOptions} from \"../domain/ParamOptions\";\nimport {ParamFn} from \"./paramFn\";\nimport {UseDeserialization} from \"./useDeserialization\";\nimport {UseParamExpression} from \"./useParamExpression\";\nimport {UseParamType} from \"./useParamType\";\nimport {UseType} from \"./useType\";\nimport {UseValidation} from \"./useValidation\";\n\n/**\n * @ignore\n * @param options\n */\nfunction mapPipes(options: Partial<ParamOptions>) {\n const {paramType, useType, expression, useValidation, useConverter, ...props} = options;\n\n return [\n useType\n ? UseType(useType)\n : ParamFn((entity, parameters) => {\n if (entity.isCollection && entity.type === Object) {\n Any()(...parameters);\n }\n }),\n useValidation && UseValidation(),\n useConverter && UseDeserialization(props)\n ];\n}\n\n/**\n * Register a new param. It use the paramType to extract value and give it to the next pipe.\n *\n * Given options allow to enable or disable following pipes:\n *\n * - useType: Add extra type for the json mapper,\n * - expression: Get property from the returned value by the previous pipe.\n * - useValidation: Apply validation from the returned value by the previous pipe.\n * - useConverter: Apply json mapper from the returned value by the previous pipe.\n *\n * @param options\n * @decorator\n * @operation\n * @input\n * @pipe\n */\nexport function UseParam(options: Partial<ParamOptions>): ParameterDecorator;\n/**\n * @deprecated Since v6\n */\nexport function UseParam(paramType: string, options?: Partial<ParamOptions>): ParameterDecorator;\nexport function UseParam(...args: any[]): ParameterDecorator {\n const options = {\n dataPath: \"$ctx\",\n ...((isString(args[0]) ? args[1] : args[0]) || {}),\n paramType: isString(args[0]) ? args[0] : args[0].paramType\n };\n\n return useDecorators(UseParamType(options), ...mapPipes(options)) as ParameterDecorator;\n}\n"]}
1
+ {"version":3,"file":"useParam.js","sourceRoot":"","sources":["../../../src/decorators/useParam.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW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AAO,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAuB,CAAC;AAC1F,CAAC","sourcesContent":["import {isString, useDecorators} from \"@tsed/core\";\nimport {Any} from \"@tsed/schema\";\nimport {ParamOptions} from \"../domain/ParamOptions\";\nimport {ParamTypes} from \"../domain/ParamTypes\";\nimport {ParamFn} from \"./paramFn\";\nimport {UseDeserialization} from \"./useDeserialization\";\nimport {UseParamType} from \"./useParamType\";\nimport {UseType} from \"./useType\";\nimport {UseValidation} from \"./useValidation\";\n\n/**\n * @ignore\n * @param options\n */\nfunction mapPipes(options: Partial<ParamOptions>) {\n const {paramType, useType, expression, useValidation, useConverter, ...props} = options;\n\n return [\n useType\n ? UseType(useType)\n : ParamFn((entity, parameters) => {\n if (entity.isCollection && entity.type === Object && paramType !== ParamTypes.FILES) {\n Any()(...parameters);\n }\n }),\n useValidation && UseValidation(),\n useConverter && UseDeserialization(props)\n ];\n}\n\n/**\n * Register a new param. It use the paramType to extract value and give it to the next pipe.\n *\n * Given options allow to enable or disable following pipes:\n *\n * - useType: Add extra type for the json mapper,\n * - expression: Get property from the returned value by the previous pipe.\n * - useValidation: Apply validation from the returned value by the previous pipe.\n * - useConverter: Apply json mapper from the returned value by the previous pipe.\n *\n * @param options\n * @decorator\n * @operation\n * @input\n * @pipe\n */\nexport function UseParam(options: Partial<ParamOptions>): ParameterDecorator;\n/**\n * @deprecated Since v6\n */\nexport function UseParam(paramType: string, options?: Partial<ParamOptions>): ParameterDecorator;\nexport function UseParam(...args: any[]): ParameterDecorator {\n const options = {\n dataPath: \"$ctx\",\n ...((isString(args[0]) ? args[1] : args[0]) || {}),\n paramType: isString(args[0]) ? args[0] : args[0].paramType\n };\n\n return useDecorators(UseParamType(options), ...mapPipes(options)) as ParameterDecorator;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-params",
3
- "version": "6.96.1",
3
+ "version": "6.97.2",
4
4
  "description": "Params module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -21,18 +21,18 @@
21
21
  "tslib": "2.2.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@tsed/core": "6.96.1",
25
- "@tsed/di": "6.96.1",
26
- "@tsed/exceptions": "6.96.1",
27
- "@tsed/json-mapper": "6.96.1",
28
- "@tsed/schema": "6.96.1"
24
+ "@tsed/core": "6.97.2",
25
+ "@tsed/di": "6.97.2",
26
+ "@tsed/exceptions": "6.97.2",
27
+ "@tsed/json-mapper": "6.97.2",
28
+ "@tsed/schema": "6.97.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@tsed/core": "^6.96.1",
32
- "@tsed/di": "^6.96.1",
33
- "@tsed/exceptions": "^6.96.1",
34
- "@tsed/json-mapper": "^6.96.1",
35
- "@tsed/schema": "^6.96.1"
31
+ "@tsed/core": "^6.97.2",
32
+ "@tsed/di": "^6.97.2",
33
+ "@tsed/exceptions": "^6.97.2",
34
+ "@tsed/json-mapper": "^6.97.2",
35
+ "@tsed/schema": "^6.97.2"
36
36
  },
37
37
  "repository": "https://github.com/tsedio/tsed",
38
38
  "bugs": {