osm-p2p-server
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -10,3 +10,3 @@ var parsexml = require('xml-parser') | ||
var ops = { create: [], modify: [], delete: [] } | ||
var ids = {} | ||
var ids = { way: {}, node: {}, relation: {} } | ||
if (xml.root.name !== 'osmChange') return ops | ||
@@ -18,4 +18,6 @@ xml.root.children.forEach(function (c) { | ||
if (doc.id && Number(doc.id) < 0) { | ||
ids[doc.id] = hex2dec(randombytes(8).toString('hex')) | ||
doc.id = ids[doc.oldId] | ||
if (has(ids, ch.name)) { | ||
ids[ch.name][doc.id] = hex2dec(randombytes(8).toString('hex')) | ||
doc.id = ids[ch.name][doc.oldId] | ||
} | ||
} | ||
@@ -51,7 +53,9 @@ if (ch.name === 'way') { | ||
op.refs = op.refs.map(function (ref) { | ||
return has(ids, ref) ? ids[ref] : ref | ||
return has(ids.node, ref) ? ids.node[ref] : ref | ||
}) | ||
} else if (op.members) { | ||
op.members.forEach(function (m) { | ||
if (has(ids, m.ref)) m.ref = ids[m.ref] | ||
if (has(ids.node, m.ref)) m.ref = ids.node[m.ref] | ||
if (has(ids.way, m.ref)) m.ref = ids.way[m.ref] | ||
if (has(ids.relation, m.ref)) m.ref = ids.relation[m.ref] | ||
}) | ||
@@ -58,0 +62,0 @@ } |
{ | ||
"name": "osm-p2p-server", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "serve osm http endpoints over a p2p db", | ||
@@ -5,0 +5,0 @@ "main": "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
39094
1181