Comparing version 1.0.13 to 1.0.14
@@ -117,34 +117,51 @@ const _ = require('lodash'); | ||
return rx.from(args.origin ? [args.origin] : args.value) | ||
.pipe( | ||
rxop.mergeMap((fromNode, fromNodeIndex) => { | ||
return rx.from(args.value) | ||
.pipe( | ||
rxop.map((toNode, toNodeIndex) => { | ||
if ( | ||
!args.origin && | ||
( | ||
(args.direction && fromNodeIndex === toNodeIndex) || | ||
(!args.direction && toNodeIndex <= fromNodeIndex) | ||
) | ||
) { | ||
return null; | ||
} | ||
const crossLink = (value, entity) => { | ||
const origin = !_.isArray(value); | ||
return { | ||
direction: args.direction, | ||
distance: args.distance, | ||
entity: args.entity, | ||
fromNode, | ||
namespace: args.namespace, | ||
toNode | ||
}; | ||
}), | ||
rxop.filter(response => !_.isNull(response)) | ||
); | ||
}), | ||
rxop.mergeMap(response => { | ||
return this.link(response); | ||
}) | ||
); | ||
return rx.from(origin ? [value] : value) | ||
.pipe( | ||
rxop.mergeMap((fromNode, fromNodeIndex) => { | ||
return rx.from(args.value) | ||
.pipe( | ||
rxop.map((toNode, toNodeIndex) => { | ||
if ( | ||
!origin && | ||
( | ||
(args.direction && fromNodeIndex === toNodeIndex) || | ||
(!args.direction && toNodeIndex <= fromNodeIndex) | ||
) | ||
) { | ||
return null; | ||
} | ||
return { | ||
direction: args.direction, | ||
distance: args.distance, | ||
entity, | ||
fromNode, | ||
namespace: args.namespace, | ||
toNode | ||
}; | ||
}), | ||
rxop.filter(response => !_.isNull(response)) | ||
); | ||
}), | ||
rxop.mergeMap(response => { | ||
return this.link(response); | ||
}) | ||
); | ||
}; | ||
if (args.origin) { | ||
if (args.cross) { | ||
return rx.merge( | ||
crossLink(args.origin, args.entity), | ||
crossLink(args.value, `x-${args.entity}`) | ||
); | ||
} | ||
return crossLink(args.origin, args.entity); | ||
} | ||
return crossLink(args.value, args.entity); | ||
}) | ||
@@ -151,0 +168,0 @@ ); |
@@ -80,2 +80,4 @@ const joi = require('@hapi/joi'); | ||
const crossLink = joi.object({ | ||
cross: joi.boolean() | ||
.default(true), | ||
direction: common.direction, | ||
@@ -82,0 +84,0 @@ distance: joi.number() |
{ | ||
"name": "graphed", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Minimum graph's data structure implemented with pluggable stores (redis, dynamodb, memory, ...) and compatible with AWS Firehose", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
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
194985
5139