sigo-entities 1.2.43 → 1.2.44
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/dist/index.js +3 -0
- package/dist/index.mjs +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -630,6 +630,9 @@ function convertStringsToDates(obj) {
|
|
|
630
630
|
var import_class_transformer2 = require("class-transformer");
|
|
631
631
|
var import_class_validator2 = require("class-validator");
|
|
632
632
|
async function validateAndFormatData(data, dtoClass, propertiesToValidate) {
|
|
633
|
+
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
634
|
+
throw new Error(`El cuerpo debe ser un objeto v\xE1lido de tipo ${dtoClass.name}`);
|
|
635
|
+
}
|
|
633
636
|
if (propertiesToValidate) {
|
|
634
637
|
if (propertiesToValidate.length === 0) {
|
|
635
638
|
throw new Error(`Debes especificar al menos una propiedad a validar`);
|
package/dist/index.mjs
CHANGED
|
@@ -78,6 +78,9 @@ function convertStringsToDates(obj) {
|
|
|
78
78
|
import { plainToInstance } from "class-transformer";
|
|
79
79
|
import { validate } from "class-validator";
|
|
80
80
|
async function validateAndFormatData(data, dtoClass, propertiesToValidate) {
|
|
81
|
+
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
82
|
+
throw new Error(`El cuerpo debe ser un objeto v\xE1lido de tipo ${dtoClass.name}`);
|
|
83
|
+
}
|
|
81
84
|
if (propertiesToValidate) {
|
|
82
85
|
if (propertiesToValidate.length === 0) {
|
|
83
86
|
throw new Error(`Debes especificar al menos una propiedad a validar`);
|