"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isValidClientLogUserAgent = exports.isValidClientLogLevel = exports.isValidClientLogMeta = exports.isValidClientLogStackTrace = exports.isValidClientLogMessage = exports.isValidLogLevel = void 0;
const tslib_1 = require("tslib");
const validator_1 = tslib_1.__importDefault(require("validator"));
const constants_1 = require("../../initializers/constants");
const misc_1 = require("./misc");
const serverLogLevels = new Set(['debug', 'info', 'warn', 'error']);
const clientLogLevels = new Set(['warn', 'error']);
function isValidLogLevel(value) {
    return (0, misc_1.exists)(value) && serverLogLevels.has(value);
}
exports.isValidLogLevel = isValidLogLevel;
function isValidClientLogMessage(value) {
    return typeof value === 'string' && validator_1.default.isLength(value, constants_1.CONSTRAINTS_FIELDS.LOGS.CLIENT_MESSAGE);
}
exports.isValidClientLogMessage = isValidClientLogMessage;
function isValidClientLogLevel(value) {
    return (0, misc_1.exists)(value) && clientLogLevels.has(value);
}
exports.isValidClientLogLevel = isValidClientLogLevel;
function isValidClientLogStackTrace(value) {
    return typeof value === 'string' && validator_1.default.isLength(value, constants_1.CONSTRAINTS_FIELDS.LOGS.CLIENT_STACK_TRACE);
}
exports.isValidClientLogStackTrace = isValidClientLogStackTrace;
function isValidClientLogMeta(value) {
    return typeof value === 'string' && validator_1.default.isLength(value, constants_1.CONSTRAINTS_FIELDS.LOGS.CLIENT_META);
}
exports.isValidClientLogMeta = isValidClientLogMeta;
function isValidClientLogUserAgent(value) {
    return typeof value === 'string' && validator_1.default.isLength(value, constants_1.CONSTRAINTS_FIELDS.LOGS.CLIENT_USER_AGENT);
}
exports.isValidClientLogUserAgent = isValidClientLogUserAgent;
//# sourceMappingURL=logs.js.map