@maioradv/nestjs-core 2.0.6 → 2.0.7
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,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
value: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const IsMetafieldClause: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
1
|
+
import { Type as TypeI } from "@nestjs/common";
|
|
2
|
+
export declare const IsMetafieldClause: <T>(dto: TypeI<T>) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,38 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.IsMetafieldClause =
|
|
3
|
+
exports.IsMetafieldClause = void 0;
|
|
13
4
|
const common_1 = require("@nestjs/common");
|
|
14
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
15
6
|
const class_transformer_1 = require("class-transformer");
|
|
16
7
|
const class_validator_1 = require("class-validator");
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
exports.MetafieldClauseDto = MetafieldClauseDto;
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, class_validator_1.IsString)(),
|
|
22
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], MetafieldClauseDto.prototype, "key", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, class_validator_1.IsString)(),
|
|
27
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], MetafieldClauseDto.prototype, "value", void 0);
|
|
30
|
-
const IsMetafieldClause = () => {
|
|
8
|
+
const IsMetafieldClause = (dto) => {
|
|
31
9
|
return (0, common_1.applyDecorators)((0, swagger_1.ApiPropertyOptional)({
|
|
10
|
+
type: String,
|
|
32
11
|
description: 'A key:value couple or a comma-separated list of couples. Format: key1:value1,key2:value2'
|
|
33
|
-
}), (0, class_transformer_1.Transform)(({ value }) => value.split(',').map(pair => {
|
|
34
|
-
const [key,
|
|
35
|
-
return { key: key.trim(), value:
|
|
36
|
-
})), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsArray)(), (0, class_validator_1.ValidateNested)({ each: true }), (0, class_transformer_1.Type)(() =>
|
|
12
|
+
}), (0, class_transformer_1.Transform)(({ value }) => (0, class_transformer_1.plainToInstance)(dto, value.split(',').map(pair => {
|
|
13
|
+
const [key, val] = pair.split(':');
|
|
14
|
+
return { key: key.trim(), value: val.trim() };
|
|
15
|
+
}))), (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsArray)(), (0, class_validator_1.ValidateNested)({ each: true }), (0, class_transformer_1.Type)(() => dto));
|
|
37
16
|
};
|
|
38
17
|
exports.IsMetafieldClause = IsMetafieldClause;
|