Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arranger/mapping-utils

Package Overview
Dependencies
Maintainers
3
Versions
270
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arranger/mapping-utils - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

18

dist/mappingToColumnsState.js

@@ -10,2 +10,4 @@ "use strict";

var _columnsToGraphql = require("./utils/columnsToGraphql");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -15,14 +17,2 @@

function toQuery(path) {
return path.split('.').reverse().reduce(function (acc, segment, i, arr) {
if (segment === 'hits') {
return "".concat(segment, "(first: 5) { total, ").concat(acc, " }");
} else if (i === 0) {
return segment;
} else {
return "".concat(segment.indexOf('edges[') === 0 ? 'edges' : segment, " { ").concat(acc, " }");
}
}, '');
}
var _default = function _default(mapping) {

@@ -40,3 +30,5 @@ return (0, _mappingToColumnsType.default)(mapping).map(function (_ref) {

}, type === 'list' ? {
query: toQuery(field),
query: (0, _columnsToGraphql.toQuery)({
accessor: field
}),
listAccessor: field.split(/\[\d*\].node/)[0],

@@ -43,0 +35,0 @@ totalAccessor: "".concat(field.split(/edges\[\d*\].node/)[0], "total"),

@@ -6,2 +6,3 @@ "use strict";

});
exports.toQuery = toQuery;
exports.default = columnsToGraphql;

@@ -11,2 +12,12 @@

function toQuery(column) {
return column.query || column.accessor.split('.').reverse().reduce(function (acc, segment, i, arr) {
if (i === 0) {
return segment;
} else {
return "".concat(segment.indexOf('edges[') === 0 ? 'edges' : segment, " {\n ").concat(acc, "\n }");
}
}, '');
}
function columnsToGraphql(_ref) {

@@ -20,17 +31,2 @@ var _ref$config = _ref.config,

first = _ref.first;
function toQuery(column) {
return column.query || column.accessor.split('.').reverse().reduce(function (acc, segment, i, arr) {
if (segment === 'hits') {
var _first = (0, _lodash.get)(arr[i - 1].match(/edges\[(\d+)\]/), '[1]', 0);
return "".concat(segment, "(first: ").concat(_first, ") {\n ").concat(acc, "\n }");
} else if (i === 0) {
return segment;
} else {
return "".concat(segment.indexOf('edges[') === 0 ? 'edges' : segment, " {\n ").concat(acc, "\n }");
}
}, '');
}
var fields = config.columns.filter(function (column) {

@@ -37,0 +33,0 @@ return !(column.accessor && column.accessor === config.keyField) && (column.fetch || column.show);

{
"name": "@arranger/mapping-utils",
"version": "0.1.10",
"version": "0.1.11",
"description": "Transform Elasticsearch mappings",

@@ -25,3 +25,3 @@ "main": "dist/index.js",

"dependencies": {
"@arranger/middleware": "^0.1.10",
"@arranger/middleware": "^0.1.11",
"babel-polyfill": "^6.26.0",

@@ -28,0 +28,0 @@ "elasticsearch": "^14.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc