@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint manager to set up, configure and monitor 3D printers. Our aim is to provide extremely optimized websocket performance and reliability.
31 lines (30 loc) • 852 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
validateInput: function() {
return validateInput;
},
validateMiddleware: function() {
return validateMiddleware;
}
});
const _runtimeexceptions = require("../exceptions/runtime.exceptions");
async function validateInput(data, zodSchema) {
const result = await zodSchema.safeParseAsync(data);
if (!result.success) {
throw new _runtimeexceptions.ValidationException(result.error);
}
return result.data;
}
async function validateMiddleware(req, zodSchema) {
return validateInput(req.body, zodSchema);
}
//# sourceMappingURL=validators.js.map