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.29 to 0.1.35

24

dist/index.js

@@ -60,2 +60,8 @@ "use strict";

});
Object.defineProperty(exports, "esToGraphqlTypeMap", {
enumerable: true,
get: function get() {
return _mappingToScalarFields.esToGraphqlTypeMap;
}
});
Object.defineProperty(exports, "getNestedFields", {

@@ -85,3 +91,2 @@ enumerable: true,

});
exports.esToGraphqlTypeMap = void 0;

@@ -104,3 +109,3 @@ var _addMappingsToTypes = _interopRequireDefault(require("./addMappingsToTypes"));

var _mappingToScalarFields = _interopRequireDefault(require("./mappingToScalarFields"));
var _mappingToScalarFields = _interopRequireWildcard(require("./mappingToScalarFields"));

@@ -115,15 +120,4 @@ var _getNestedFields = _interopRequireDefault(require("./getNestedFields"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
var esToGraphqlTypeMap = {
keyword: 'String',
string: 'String',
text: 'String',
date: 'String',
boolean: 'Boolean',
long: 'Float',
double: 'Float',
integer: 'Float',
float: 'Float'
};
exports.esToGraphqlTypeMap = esToGraphqlTypeMap;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -29,4 +29,3 @@ "use strict";

type: type,
active: false,
layout: null
active: false
};

@@ -33,0 +32,0 @@ });

@@ -31,3 +31,3 @@ "use strict";

}),
jsonPath: "$.".concat(field.replace(/\[\d*\]/g, '.'))
jsonPath: "$.".concat(field.replace(/\[\d*\]/g, '[*]'))
} : {

@@ -34,0 +34,0 @@ accessor: field

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -26,4 +28,5 @@

var mappingToFields = function mappingToFields(_ref) {
var type = _ref.type;
return [(0, _mappingToObjectTypes.default)(type.name, type.mapping), Object.entries(type.mapping).filter(function (_ref2) {
var type = _ref.type,
parent = _ref.parent;
return [(0, _mappingToObjectTypes.default)(type.name, type.mapping, parent, type.extendedFields), Object.entries(type.mapping).filter(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),

@@ -39,10 +42,11 @@ metadata = _ref3[1];

return mappingToFields({
type: {
parent: [parent, field].filter(Boolean).join('.'),
type: _extends({}, type, {
name: type.name + (0, _lodash.capitalize)(field),
mapping: metadata.properties
}
})
});
}), (0, _createConnectionTypeDefs.default)({
type: type,
fields: [(0, _mappingToScalarFields.default)(type.mapping, type.extendedFields), (0, _mappingToNestedFields.default)(type.name, type.mapping), type.customFields]
fields: [(0, _mappingToScalarFields.default)(type.mapping, type.extendedFields, parent), (0, _mappingToNestedFields.default)(type.name, type.mapping, parent, type.extendedFields), type.customFields]
})].join();

@@ -49,0 +53,0 @@ };

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -25,3 +27,3 @@

var mappingToNestedTypes = function mappingToNestedTypes(type, mapping) {
var mappingToNestedTypes = function mappingToNestedTypes(type, mapping, parent, extendedFields) {
return Object.entries(mapping).filter(function (_ref) {

@@ -37,9 +39,9 @@ var _ref2 = _slicedToArray(_ref, 2),

return "\n ".concat((0, _mappingToObjectTypes.default)(type + (0, _lodash.capitalize)(field), metadata.properties), ",\n ").concat(mappingToNestedTypes(type + (0, _lodash.capitalize)(field), metadata.properties).join('\n'), "\n ").concat((0, _createConnectionTypeDefs.default)({
type: {
return "\n ".concat((0, _mappingToObjectTypes.default)(type + (0, _lodash.capitalize)(field), metadata.properties, [parent, field].filter(Boolean).join('.'), extendedFields), ",\n ").concat(mappingToNestedTypes(type + (0, _lodash.capitalize)(field), metadata.properties, [parent, field].filter(Boolean).join('.'), extendedFields).join('\n'), "\n ").concat((0, _createConnectionTypeDefs.default)({
type: _extends({}, type, {
name: type + (0, _lodash.capitalize)(field),
mapping: metadata.properties
},
fields: [(0, _mappingToScalarFields.default)(metadata.properties), (0, _mappingToNestedFields.default)(type + (0, _lodash.capitalize)(field), metadata.properties)]
}), "\n\n ");
}),
fields: [(0, _mappingToScalarFields.default)(metadata.properties, extendedFields, [parent, field].filter(Boolean).join('.')), (0, _mappingToNestedFields.default)(type + (0, _lodash.capitalize)(field), metadata.properties, [parent, field].filter(Boolean).join('.'), extendedFields)]
}), "\n ");
});

@@ -46,0 +48,0 @@ };

@@ -26,3 +26,3 @@ "use strict";

var mappingToObjectTypes = function mappingToObjectTypes(type, mapping) {
var mappingToObjectTypes = function mappingToObjectTypes(type, mapping, parent, extendedFields) {
return Object.entries(mapping).filter(function (_ref) {

@@ -38,3 +38,3 @@ var _ref2 = _slicedToArray(_ref, 2),

return "\n ".concat(mappingToObjectTypes(type + (0, _lodash.capitalize)(field), metadata.properties), ",\n ").concat((0, _mappingToNestedTypes.default)(type + (0, _lodash.capitalize)(field), metadata.properties).join('\n'), "\n type ").concat(type + (0, _lodash.capitalize)(field), " {\n ").concat((0, _mappingToNestedFields.default)(type + (0, _lodash.capitalize)(field), metadata.properties), "\n ").concat((0, _mappingToScalarFields.default)(metadata.properties), "\n }\n ");
return "\n ".concat(mappingToObjectTypes(type + (0, _lodash.capitalize)(field), metadata.properties, [parent, field].filter(Boolean).join('.'), extendedFields), ",\n ").concat((0, _mappingToNestedTypes.default)(type + (0, _lodash.capitalize)(field), metadata.properties, [parent, field].filter(Boolean).join('.'), extendedFields).join('\n'), "\n type ").concat(type + (0, _lodash.capitalize)(field), " {\n ").concat((0, _mappingToNestedFields.default)(type + (0, _lodash.capitalize)(field), metadata.properties, [parent, field].filter(Boolean).join('.'), extendedFields), "\n ").concat((0, _mappingToScalarFields.default)(metadata.properties, extendedFields, [parent, field].filter(Boolean).join('.')), "\n }\n ");
});

@@ -54,3 +54,3 @@ }; // TODO: figure out where this is making a dupe fiel

// type ${type + capitalize(field)} {
// ${mappingToScalarFields(metadata.properties)}
// ${mappingToScalarFields(metadata.properties, type.extendedFields)}
// }

@@ -57,0 +57,0 @@ // `,

@@ -25,11 +25,12 @@ "use strict";

var maybeArray = function maybeArray(field, extendedFields, type) {
var maybeArray = function maybeArray(field, extendedFields, type, parent) {
var _extendedFields$find;
var fullField = [parent, field].filter(Boolean).join('.');
return (extendedFields === null || extendedFields === void 0 ? void 0 : (_extendedFields$find = extendedFields.find(function (x) {
return x.field === field;
return x.field === fullField;
})) === null || _extendedFields$find === void 0 ? void 0 : _extendedFields$find.isArray) ? "[".concat(type, "]") : type;
};
var _default = function _default(mapping, extendedFields) {
var _default = function _default(mapping, extendedFields, parent) {
return Object.entries(mapping).filter(function (_ref) {

@@ -45,3 +46,3 @@ var _ref2 = _slicedToArray(_ref, 2),

return "".concat(field, ": ").concat(maybeArray(field, extendedFields, esToGraphqlTypeMap[metadata.type]));
return "".concat(field, ": ").concat(maybeArray(field, extendedFields, esToGraphqlTypeMap[metadata.type], parent));
});

@@ -48,0 +49,0 @@ };

@@ -58,6 +58,10 @@ "use strict";

}
} : resolveNested({
} : _typeof(hits) === 'object' ? Object.assign(hits.constructor(), resolveNested({
node: hits,
nested_fields: nested_fields,
parent: fullPath
})) : resolveNested({
node: hits,
nested_fields: nested_fields,
parent: fullPath
})));

@@ -64,0 +68,0 @@ }, {});

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

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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