You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
689 B
JavaScript
20 lines
689 B
JavaScript
"use strict";
|
|
|
|
const either = require("@validatem/either");
|
|
|
|
const isLiteralValue = require("../is-literal-value");
|
|
|
|
// NOTE: This validator should typically come last in an `either`, since it will catch various types of inputs (sqlExpression, literal values, etc.) that might need to be interpreted differently in specific contexts.
|
|
|
|
module.exports = function (operations) {
|
|
const isObjectType = require("./is-object-type")(operations);
|
|
const wrapWithOperation = require("./wrap-with-operation")(operations);
|
|
|
|
return either([
|
|
[ isObjectType("sqlExpression") ],
|
|
[ isObjectType("literalValue") ],
|
|
[ isObjectType("field") ],
|
|
[ isLiteralValue, wrapWithOperation("value") ]
|
|
]);
|
|
};
|