es-alchemy
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -6,3 +6,3 @@ // Convert raw data into index ready data | ||
const result = []; | ||
assert(specs.sources === undefined || Array.isArray(specs.sources) && specs.sources.length !== 0); | ||
assert(specs.sources === undefined || Array.isArray(specs.sources) && specs.sources.length !== 0, "Invalid sources definition."); | ||
(specs.sources || [""]). // resolve to all objects for path | ||
@@ -24,3 +24,3 @@ map(sourcePath => sourcePath === "" ? input : sourcePath.split(".").reduce((origins, segment) => origins.map(origin => origin[segment]).filter(origin => !!origin).reduce((prev, next) => prev.concat(Array.isArray(next) ? next : [next]), []), [input])) // filter invalid origins | ||
})); | ||
assert(specs.model.endsWith("[]") || result.length <= 1); | ||
assert(specs.model.endsWith("[]") || result.length <= 1, "More than one result for relationship."); | ||
return specs.model.endsWith("[]") ? result : result[0]; | ||
@@ -30,2 +30,2 @@ }; | ||
module.exports.remap = (specs, input) => remapRec(specs, input); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2RhdGEuanMiXSwibmFtZXMiOlsiYXNzZXJ0IiwicmVxdWlyZSIsInJlbWFwUmVjIiwic3BlY3MiLCJpbnB1dCIsInJlc3VsdCIsInNvdXJjZXMiLCJ1bmRlZmluZWQiLCJBcnJheSIsImlzQXJyYXkiLCJsZW5ndGgiLCJtYXAiLCJzb3VyY2VQYXRoIiwic3BsaXQiLCJyZWR1Y2UiLCJvcmlnaW5zIiwic2VnbWVudCIsIm9yaWdpbiIsImZpbHRlciIsInByZXYiLCJuZXh0IiwiY29uY2F0IiwiZm9yRWFjaCIsImVudHJ5IiwiZmllbGRzIiwiZmllbGQiLCJrdiIsImtleSIsInZhbHVlIiwiT2JqZWN0IiwiYXNzaWduIiwiZW50cmllcyIsIm5lc3RlZCIsInB1c2giLCJtb2RlbCIsImVuZHNXaXRoIiwibW9kdWxlIiwiZXhwb3J0cyIsInJlbWFwIl0sI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IHsgW2tleV06IHZhbHVlIH0pLCBlbnRyeSk7XG4gICAgICByZXN1bHQucHVzaChlbnRyeSk7XG4gICAgfSkpO1xuICBhc3NlcnQoXG4gICAgc3BlY3MubW9kZWwuZW5kc1dpdGgoXCJbXVwiKSB8fCByZXN1bHQubGVuZ3RoIDw9IDEsXG4gICAgXCJNb3JlIHRoYW4gb25lIHJlc3VsdCBmb3IgcmVsYXRpb25zaGlwLlwiXG4gICk7XG4gIHJldHVybiBzcGVjcy5tb2RlbC5lbmRzV2l0aChcIltdXCIpID8gcmVzdWx0IDogcmVzdWx0WzBdO1xufTtcblxubW9kdWxlLmV4cG9ydHMucmVtYXAgPSAoc3BlY3MsIGlucHV0KSA9PiByZW1hcFJlYyhzcGVjcywgaW5wdXQpO1xuIl19 |
@@ -7,8 +7,8 @@ // Translate index from esalchemy syntax to ES syntax | ||
const buildPropertiesRec = (specs, models) => { | ||
assert(typeof specs.model === "string"); | ||
assert(specs.nested === undefined || typeof specs.nested === "object" && !Array.isArray(specs.nested)); | ||
assert(Array.isArray(specs.fields)); | ||
assert(typeof specs.model === "string", "Model name not string."); | ||
assert(specs.nested === undefined || typeof specs.nested === "object" && !Array.isArray(specs.nested), "Nested expected to be of type object."); | ||
assert(Array.isArray(specs.fields), "Fields expected to be array."); | ||
const model = models[specs.model.endsWith("[]") ? specs.model.slice(0, -2) : specs.model]; | ||
assert(model !== undefined); | ||
assert(specs.fields.every(f => model.compiled.fields[f] !== undefined)); | ||
assert(model !== undefined, "Model name not registered."); | ||
assert(specs.fields.every(f => model.compiled.fields[f] !== undefined), "Unknown field provided."); | ||
const nested = Object.entries(specs.nested || {}); | ||
@@ -39,2 +39,2 @@ return nested.reduce((prev, [key, value]) => Object.assign(prev, { | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2luZGV4LmpzIl0sIm5hbWVzIjpbImFzc2VydCIsInJl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dWNlKChwcmV2LCBrZXkpID0+IE9iamVjdC5hc3NpZ24ocHJldiwgeyBba2V5XTogbW9kZWwuY29tcGlsZWQuZmllbGRzW2tleV0gfSksIHt9KVxuICApO1xufTtcblxuY29uc3QgZXh0cmFjdEZpZWxkc1JlYyA9IChzcGVjcywgcHJlZml4ID0gW10pID0+IE9iamVjdFxuICAuZW50cmllcyhzcGVjcy5uZXN0ZWQgfHwge30pXG4gIC5tYXAoKFtrZXksIHZhbHVlXSkgPT4gZXh0cmFjdEZpZWxkc1JlYyh2YWx1ZSwgWy4uLnByZWZpeCwga2V5XSkpXG4gIC5yZWR1Y2UoXG4gICAgKHAsIGMpID0+IHAuY29uY2F0KGMpLFxuICAgIHNwZWNzLmZpZWxkcy5tYXAoZmllbGQgPT4gWy4uLnByZWZpeCwgZmllbGRdLmpvaW4oXCIuXCIpKVxuICApO1xuXG5tb2R1bGUuZXhwb3J0cyA9ICh7XG4gIGdlbmVyYXRlTWFwcGluZzogKG5hbWUsIHNwZWNzLCBtb2RlbHMpID0+ICh7XG4gICAgbWFwcGluZ3M6IHtcbiAgICAgIFtuYW1lXToge1xuICAgICAgICBwcm9wZXJ0aWVzOiBidWlsZFByb3BlcnRpZXNSZWMoc3BlY3MsIG1vZGVscylcbiAgICAgIH1cbiAgICB9XG4gIH0pLFxuICBleHRyYWN0RmllbGRzOiBzcGVjcyA9PiBleHRyYWN0RmllbGRzUmVjKHNwZWNzKVxufSk7XG4iXX0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2luZGV4LmpzIl0sIm5hbWVzIjpbImFzc2VydCIsInJlcXVpcmUiLCJnZXQiLCJidWlsZFByb3BlcnRpZXNSZWMiLCJzcGVjcyIsIm1vZGVscyIsIm1vZGVsIiwibmVzdGVkIiwidW5kZWZpbmVkIiwiQXJyYXkiLCJpc0FycmF5IiwiZmllbGRzIiwiZW5kc1dpdGg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1JlYyh2YWx1ZSwgbW9kZWxzKSwgdHlwZTogXCJuZXN0ZWRcIiB9LFxuICAgICAgICBnZXQodmFsdWUsICdmbGF0JywgZmFsc2UpID09PSB0cnVlID8geyBpbmNsdWRlX2luX3Jvb3Q6IHRydWUgfSA6IHt9XG4gICAgICApXG4gICAgfSksXG4gICAgc3BlY3MuZmllbGRzLnJlZHVjZSgocHJldiwga2V5KSA9PiBPYmplY3QuYXNzaWduKHByZXYsIHsgW2tleV06IG1vZGVsLmNvbXBpbGVkLmZpZWxkc1trZXldIH0pLCB7fSlcbiAgKTtcbn07XG5cbmNvbnN0IGV4dHJhY3RGaWVsZHNSZWMgPSAoc3BlY3MsIHByZWZpeCA9IFtdKSA9PiBPYmplY3RcbiAgLmVudHJpZXMoc3BlY3MubmVzdGVkIHx8IHt9KVxuICAubWFwKChba2V5LCB2YWx1ZV0pID0+IGV4dHJhY3RGaWVsZHNSZWModmFsdWUsIFsuLi5wcmVmaXgsIGtleV0pKVxuICAucmVkdWNlKFxuICAgIChwLCBjKSA9PiBwLmNvbmNhdChjKSxcbiAgICBzcGVjcy5maWVsZHMubWFwKGZpZWxkID0+IFsuLi5wcmVmaXgsIGZpZWxkXS5qb2luKFwiLlwiKSlcbiAgKTtcblxubW9kdWxlLmV4cG9ydHMgPSAoe1xuICBnZW5lcmF0ZU1hcHBpbmc6IChuYW1lLCBzcGVjcywgbW9kZWxzKSA9PiAoe1xuICAgIG1hcHBpbmdzOiB7XG4gICAgICBbbmFtZV06IHtcbiAgICAgICAgcHJvcGVydGllczogYnVpbGRQcm9wZXJ0aWVzUmVjKHNwZWNzLCBtb2RlbHMpXG4gICAgICB9XG4gICAgfVxuICB9KSxcbiAgZXh0cmFjdEZpZWxkczogc3BlY3MgPT4gZXh0cmFjdEZpZWxkc1JlYyhzcGVjcylcbn0pO1xuIl19 |
@@ -8,3 +8,3 @@ // Translate model from esalchemy syntax to ES syntax | ||
compile: specs => { | ||
assert(typeof specs.fields === "object" && !Array.isArray(specs.fields)); | ||
assert(typeof specs.fields === "object" && !Array.isArray(specs.fields), "Model definition expected to be of type object."); | ||
return Object.assign({}, specs, { | ||
@@ -17,2 +17,2 @@ fields: Object.entries(specs.fields).reduce((prev, [key, value]) => Object.assign(prev, { | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL21vZGVsLmpzIl0sIm5hbWVzIjpbImFzc2VydCIsInJlcXVpcmUiLCJmaWVsZERlZmluaXRpb25zIiwibW9kdWxlIiwiZXhwb3J0cyIsImNvbXBpbGUiLCJzcGVjcyIsImZpZWxkcyIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImFzc2lnbiIsImVudHJpZXMiLCJyZWR1Y2UiLCJwcmV2Iiwia2V5IiwidmFsdWUiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0EsTUFBTUEsU0FBU0MsUUFBUSxRQUFSLENBQWY7O0FBQ0EsTUFBTUMsbUJBQW1CRCxRQUFRLGdDQUFSLENBQXpCOztBQUVBRSxPQUFPQyxPQUFQLEdBQWtCO0FBQ2hCQyxXQUFVQyxLQUFELElBQVc7QUFDbEJOLFdBQU8sT0FBT00sTUFBTUMsTUFBYixLQUF3QixRQUF4QixJQUFvQyxDQUFDQyxNQUFNQyxPQUFOLENBQWNILE1BQU1DLE1BQXBCLENBQTVDO0FBQ0EsV0FBT0csT0FBT0MsTUFBUCxDQUFjLEVBQWQsRUFBa0JMLEtBQWxCLEVBQXlCO0FBQzlCQyxjQUFRRyxPQUNMRSxPQURLLENBQ0dOLE1BQU1DLE1BRFQsRUFFTE0sTUFGSyxDQUVFLENBQUNDLElBQUQsRUFBTyxDQUFDQyxHQUFELEVBQU1DLEtBQU4sQ0FBUCxLQUF3Qk4sT0FBT0MsTUFBUCxDQUFjRyxJQUFkLEVBQW9CO0FBQUUsU0FBQ0MsR0FBRCxHQUFPYixpQkFBaUJjLEtBQWpCO0FBQVQsT0FBcEIsQ0FGMUIsRUFFbUYsRUFGbkY7QUFEc0IsS0FBekIsQ0FBUDtBQUtEO0FBUmUsQ0FBbEIiLCJmaWxlIjoibW9kZWwuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUcmFuc2xhdGUgbW9kZWwgZnJvbSBlc2FsY2hlbXkgc3ludGF4IHRvIEVTIHN5bnRheFxuY29uc3QgYXNzZXJ0ID0gcmVxdWlyZShcImFzc2VydFwiKTtcbmNvbnN0IGZpZWxkRGVmaW5pdGlvbnMgPSByZXF1aXJlKFwiLi4vcmVzb3VyY2VzL2ZpZWxkLWRlZmluaXRpb25zXCIpO1xuXG5tb2R1bGUuZXhwb3J0cyA9ICh7XG4gIGNvbXBpbGU6IChzcGVjcykgPT4ge1xuICAgIGFzc2VydCh0eXBlb2Ygc3BlY3MuZmllbGRzID09PSBcIm9iamVjdFwiICYmICFBcnJheS5pc0FycmF5KHNwZWNzLmZpZWxkcykpO1xuICAgIHJldHVybiBPYmplY3QuYXNzaWduKHt9LCBzcGVjcywge1xuICAgICAgZmllbGRzOiBPYmplY3RcbiAgICAgICAgLmVudHJpZXMoc3BlY3MuZmllbGRzKVxuICAgICAgICAucmVkdWNlKChwcmV2LCBba2V5LCB2YWx1ZV0pID0+IE9iamVjdC5hc3NpZ24ocHJldiwgeyBba2V5XTogZmllbGREZWZpbml0aW9uc1t2YWx1ZV0gfSksIHt9KVxuICAgIH0pO1xuICB9XG59KTtcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL21vZGVsLmpzIl0sIm5hbWVzIjpbImFzc2VydCIsInJlcXVpcmUiLCJmaWVsZERlZmluaXRpb25zIiwibW9kdWxlIiwiZXhwb3J0cyIsImNvbXBpbGUiLCJzcGVjcyIsImZpZWxkcyIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImFzc2lnbiIsIm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PiB7XG4gICAgYXNzZXJ0KFxuICAgICAgdHlwZW9mIHNwZWNzLmZpZWxkcyA9PT0gXCJvYmplY3RcIiAmJiAhQXJyYXkuaXNBcnJheShzcGVjcy5maWVsZHMpLFxuICAgICAgXCJNb2RlbCBkZWZpbml0aW9uIGV4cGVjdGVkIHRvIGJlIG9mIHR5cGUgb2JqZWN0LlwiXG4gICAgKTtcbiAgICByZXR1cm4gT2JqZWN0LmFzc2lnbih7fSwgc3BlY3MsIHtcbiAgICAgIGZpZWxkczogT2JqZWN0XG4gICAgICAgIC5lbnRyaWVzKHNwZWNzLmZpZWxkcylcbiAgICAgICAgLnJlZHVjZSgocHJldiwgW2tleSwgdmFsdWVdKSA9PiBPYmplY3QuYXNzaWduKHByZXYsIHsgW2tleV06IGZpZWxkRGVmaW5pdGlvbnNbdmFsdWVdIH0pLCB7fSlcbiAgICB9KTtcbiAgfVxufSk7XG4iXX0= |
@@ -14,3 +14,3 @@ const assert = require('assert'); | ||
if (Array.isArray(filterBy)) { | ||
assert(allowedFields === null || allowedFields.includes(filterBy[0])); | ||
assert(allowedFields === null || allowedFields.includes(filterBy[0]), "Unexpected field in filter."); | ||
return [filterBy[0].substring(0, filterBy[0].lastIndexOf('.')), actionMap.filter[filterBy[1]](filterBy[0], ...filterBy.slice(2))]; | ||
@@ -20,10 +20,10 @@ } // handle "or" and "and" clauses | ||
assert(typeof filterBy === "object" && !Array.isArray(filterBy)); | ||
assert(Object.keys(filterBy).length === 1); | ||
assert(typeof filterBy === "object" && !Array.isArray(filterBy), "Filter clause expected to be of type object."); | ||
assert(Object.keys(filterBy).length === 1, "Filter clause expected to have one entry."); | ||
const [clause, filters] = Object.entries(filterBy)[0]; | ||
assert(["or", "and"].includes(clause)); // handle clause content recursively | ||
assert(["or", "and"].includes(clause), "Filter clause to be `or` or `and`."); // handle clause content recursively | ||
const groups = {}; | ||
filters.forEach(filter => { | ||
assert(["string", "object"].includes(typeof filter)); | ||
assert(["string", "object"].includes(typeof filter), "Filter clause entries expected to be string, array or object."); | ||
const [prefix, logic] = buildQueryRec(typeof filter === 'string' ? filter.split(" ") : filter, allowedFields); | ||
@@ -66,6 +66,6 @@ | ||
from: typeof offset === "number" ? offset : 0 | ||
}; // eslint-disable-next-line no-underscore-dangle | ||
}; | ||
assert( // eslint-disable-next-line no-underscore-dangle | ||
allowedFields === null || isEqual(toReturn, [""]) || result._source.every(f => allowedFields.includes(f)), `Invalid field(s) provided.`); | ||
assert(allowedFields === null || result._source.every(f => allowedFields.includes(f))); | ||
if (filterBy.length !== 0) { | ||
@@ -97,2 +97,2 @@ result.query = buildQueryRec(filterBy, allowedFields)[1]; | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3F1ZXJ5LmpzIl0sIm5hbWVzIjpbImFzc2VydCIsInJlcXVpcmUiLCJnZXQiLCJpc0VxdWFsIiwib2JqZWN0UGF0aHMiLCJhY3Rpb25NYXAiLCJidWlsZFF1ZXJ5UmVjIiwiZmlsdGVyQnkiLCJhbGxvd2VkRmllbGRzIiwiQXJyYXkiLCJpc0FycmF5IiwiaW5jbHVkZXMiLCJzdWJzdHJpbmciLCJsYXN0SW5kZXhPZiIsImZpbHRlciIsInNsaWNlIiwiT2JqZWN0Iiwia2V5cyIsImxlbmd0aCIsImNsYXVzZSIsImZpbHRlcnMiLCJlbnRyaWVzIiwiZ3JvdXBzIiwiZm9yRWFjaCIsInByZWZpeCIsImxvZ2ljIiwic3BsaXQiLCJ1bmRlZmluZWQiLCJwdXNoIiwicmVzdWx0cyIsImxvZ2ljcyIsIm5lc3QiLCJtb2R1bGUiLCJleHBvcnRzIiwiYnVpbGQiLCJ0b1JldHVybiIsIm9yZGVyQnkiLCJzY29yZUJ5IiwibGltaXQiLCJvZmZzZXQiLCJyZXN1bHQiLCJfc291cmNlIiwic2l6ZSIsImZyb20iLCJldmVyeSIsImYiLCJxdWVyeSIsIn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ZpZGVkLmBcbiAgKTtcbiAgaWYgKGZpbHRlckJ5Lmxlbmd0aCAhPT0gMCkge1xuICAgIHJlc3VsdC5xdWVyeSA9IGJ1aWxkUXVlcnlSZWMoZmlsdGVyQnksIGFsbG93ZWRGaWVsZHMpWzFdO1xuICB9XG4gIHJlc3VsdC5zb3J0ID0gb3JkZXJCeVxuICAgIC5jb25jYXQoaXNFcXVhbChvcmRlckJ5LnNsaWNlKC0xKSwgW1tcImlkXCIsIFwiYXNjXCJdXSkgPyBbXSA6IFtbXCJpZFwiLCBcImFzY1wiXV0pXG4gICAgLm1hcChlID0+IGFjdGlvbk1hcC5vcmRlcltlWzFdXShlWzBdLCAuLi5lLnNsaWNlKDIpKSk7XG4gIGlmIChzY29yZUJ5Lmxlbmd0aCAhPT0gMCkge1xuICAgIHJlc3VsdC5xdWVyeSA9IHtcbiAgICAgIGZ1bmN0aW9uX3Njb3JlOiB7XG4gICAgICAgIHF1ZXJ5OiBnZXQocmVzdWx0LCAncXVlcnknLCB7IG1hdGNoX2FsbDoge30gfSksXG4gICAgICAgIGZ1bmN0aW9uczogc2NvcmVCeS5tYXAoZSA9PiBhY3Rpb25NYXAuc2NvcmVbZVswXV0oLi4uZS5zbGljZSgxKSkpLFxuICAgICAgICBzY29yZV9tb2RlOiBcInN1bVwiLFxuICAgICAgICBib29zdF9tb2RlOiBcInJlcGxhY2VcIlxuICAgICAgfVxuICAgIH07XG4gICAgcmVzdWx0LnNvcnQucHVzaCh7IF9zY29yZTogeyBvcmRlcjogXCJkZXNjXCIgfSB9KTtcbiAgfVxuICByZXR1cm4gcmVzdWx0O1xufTtcbiJdfQ== |
{ | ||
"name": "es-alchemy", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Simplification of Elasticsearch interactions", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83210
581