@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.
29 lines (28 loc) • 822 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, {
idRuleV2: function() {
return idRuleV2;
},
idRulesV2: function() {
return idRulesV2;
}
});
const _zod = require("zod");
const isHexadecimal = (str)=>/^[a-fA-F0-9]+$/.test(str);
const isMongoId = (str)=>isHexadecimal(str) && str.length === 24;
const idRuleV2 = (isSqlite)=>isSqlite ? _zod.z.number().min(1) : _zod.z.string().refine(isMongoId, {
message: "Invalid MongoDB ObjectId"
});
const idRulesV2 = (isSqlite)=>_zod.z.object({
id: idRuleV2(isSqlite)
}).strict();
//# sourceMappingURL=generic.validation.js.map