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.
25 lines
743 B
JavaScript
25 lines
743 B
JavaScript
"use strict";
|
|
|
|
const { validateArguments } = require("@validatem/core");
|
|
const defaultTo = require("@validatem/default-to");
|
|
const arrayOf = require("@validatem/array-of");
|
|
|
|
const makeIndexObject = require("./_make-index-object");
|
|
|
|
module.exports = function (operations) {
|
|
const isIndexFields = require("../../validators/operations/is-index-fields")(operations);
|
|
const isObjectType = require("../../validators/operations/is-object-type")(operations);
|
|
|
|
return function index(_fields, _clauses) {
|
|
let [ fields, clauses ] = validateArguments(arguments, {
|
|
fields: isIndexFields,
|
|
clauses: [ defaultTo([]), arrayOf(isObjectType("where")) ]
|
|
});
|
|
|
|
return makeIndexObject(fields, {
|
|
clauses: clauses,
|
|
indexType: "index"
|
|
});
|
|
};
|
|
};
|