@maioradv/nestjs-core 1.2.8 → 1.2.10

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.
@@ -6,10 +6,19 @@ const swagger_1 = require("@nestjs/swagger");
6
6
  const class_transformer_1 = require("class-transformer");
7
7
  const class_validator_1 = require("class-validator");
8
8
  const IsStringClause = (options) => {
9
- return (0, common_1.applyDecorators)((0, swagger_1.ApiPropertyOptional)({
10
- type: String,
11
- description: options?.isArray ? 'A string or a comma-separated list of strings' : 'Check if field contains the string'
12
- }), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsString)(), options?.isArray ? (0, class_validator_1.IsArray)() : undefined, options?.isArray ? (0, class_transformer_1.Transform)(({ value }) => value.split(',')) : undefined);
9
+ const decorators = [
10
+ (0, swagger_1.ApiPropertyOptional)({
11
+ type: String,
12
+ description: options?.isArray ? 'A string or a comma-separated list of strings' : 'Check if field contains the string'
13
+ }),
14
+ (0, class_validator_1.IsOptional)(),
15
+ (0, class_validator_1.IsString)({ each: options?.isArray ? true : undefined })
16
+ ];
17
+ if (options?.isArray) {
18
+ decorators.push((0, class_validator_1.IsArray)());
19
+ decorators.push((0, class_transformer_1.Transform)(({ value }) => value.split(',')));
20
+ }
21
+ return (0, common_1.applyDecorators)(...decorators);
13
22
  };
14
23
  exports.IsStringClause = IsStringClause;
15
24
  const IsEnumClause = (model) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/nestjs-core",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "NestJS helpers by MaiorADV",
5
5
  "repository": "https://github.com/maioradv/nestjs-core.git",
6
6
  "author": "Maior ADV Srl",