@dialexa/pleco-joi
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.limitOffsetPageSchema = exports.sortDirectionSchema = exports.filterQuerySchema = void 0; | ||
const joi_1 = __importDefault(require("@hapi/joi")); | ||
@@ -14,4 +15,4 @@ const filterInputBasicSchema = (joiType) => ({ | ||
}); | ||
const filterInputExtendedSchema = (joiType) => (Object.assign({}, filterInputBasicSchema(joiType), { gt: joiType, lt: joiType, gte: joiType, lte: joiType })); | ||
const filterInputStringSchema = (joiType) => (Object.assign({}, filterInputExtendedSchema(joiType), { contains: joiType })); | ||
const filterInputExtendedSchema = (joiType) => (Object.assign(Object.assign({}, filterInputBasicSchema(joiType)), { gt: joiType, lt: joiType, gte: joiType, lte: joiType })); | ||
const filterInputStringSchema = (joiType) => (Object.assign(Object.assign({}, filterInputExtendedSchema(joiType)), { contains: joiType })); | ||
const filterInputSchemas = (joiType) => ({ | ||
@@ -24,3 +25,3 @@ Boolean: filterInputBasicSchema(joiType), | ||
}); | ||
exports.filterQuerySchema = (graphQLType, joiType) => joi_1.default.alternatives().try([ | ||
const filterQuerySchema = (graphQLType, joiType) => joi_1.default.alternatives().try([ | ||
joi_1.default.object().keys(Object.assign({ AND: joi_1.default.lazy(() => joi_1.default.array().items(exports.filterQuerySchema(graphQLType, joiType))), OR: joi_1.default.lazy(() => joi_1.default.array().items(exports.filterQuerySchema(graphQLType, joiType))) }, filterInputSchemas(joiType)[graphQLType])), | ||
@@ -30,2 +31,3 @@ joiType, | ||
]); | ||
exports.filterQuerySchema = filterQuerySchema; | ||
exports.sortDirectionSchema = joi_1.default.string().valid(['asc', 'desc']).insensitive().uppercase(); | ||
@@ -32,0 +34,0 @@ exports.limitOffsetPageSchema = joi_1.default.object().keys({ |
{ | ||
"name": "@dialexa/pleco-joi", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "dist/index.js", | ||
@@ -52,3 +52,3 @@ "typings": "dist/index.d.ts", | ||
}, | ||
"gitHead": "2681cc473594e15a9ba309fc90cbd229cfd948fe" | ||
"gitHead": "e43d5126a1e98912c7d5777653e7d636f73fec96" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8932
7
39