osm-p2p-server
Advanced tools
Comparing version 2.1.5 to 2.1.6
@@ -21,4 +21,17 @@ var collect = require('collect-stream') | ||
// For now, filter deletions (until downstream can handle them) | ||
// For now, filter deletions (until downstream can handle them). | ||
// | ||
// This also involves removing references to deleted nodes from ways (iD | ||
// handles this poorly). This relies on the fact that nodes come before | ||
// ways from the osm-p2p-db query. | ||
var nodesSeen = {} | ||
var deletionFilter = through.obj(function (chunk, enc, next) { | ||
if (chunk.type === 'node') { | ||
nodesSeen[chunk.id] = true | ||
} else if (chunk.type === 'way') { | ||
chunk.refs = chunk.refs.filter(function (id) { | ||
return !!nodesSeen[id] | ||
}) | ||
} | ||
if (!chunk.deleted) next(null, chunk) | ||
@@ -25,0 +38,0 @@ else next() |
@@ -82,2 +82,3 @@ var errors = require('../errors') | ||
} | ||
if (change.action === 'create') op.links = [] | ||
if (change.action !== 'create' && change.version) { | ||
@@ -84,0 +85,0 @@ op.links = change.version.split(/\s*,\s*/).filter(Boolean) |
@@ -5,2 +5,7 @@ # Change Log | ||
## Unreleased | ||
### Fixed | ||
- Add empty links array to new element in changelog uploads, avoids unnecessary lookups in hyperkv for previous versions of a new element | ||
## [2.1.5] | ||
@@ -7,0 +12,0 @@ ### Fixed |
{ | ||
"name": "osm-p2p-server", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "Peer-to-peer OpenStreetMap API v0.6 Server", | ||
@@ -62,3 +62,2 @@ "main": "index.js", | ||
"express": "^4.14.0", | ||
"fd-chunk-store": "^2.0.0", | ||
"hyperlog": "^4.10.0", | ||
@@ -68,4 +67,4 @@ "hyperquest": "^2.0.0", | ||
"memdb": "^1.3.1", | ||
"memory-chunk-store": "github:noffle/memory-chunk-store", | ||
"nyc": "^10.1.2", | ||
"osm-p2p": "^1.4.0", | ||
"osm-p2p-db": "^4.0.0", | ||
@@ -72,0 +71,0 @@ "run-waterfall": "^1.1.3", |
var test = require('tape') | ||
var path = require('path') | ||
var tmpdir = require('os').tmpdir() | ||
var osmdb = require('osm-p2p') | ||
var osmdb = require('../lib/test_db') | ||
var isISODate = require('isostring') | ||
@@ -42,3 +40,3 @@ | ||
t.plan(5) | ||
var osm = osmdb(path.join(tmpdir, 'osm-p2p-server-test-' + Math.random())) | ||
var osm = osmdb() | ||
var testChangeset = { | ||
@@ -45,0 +43,0 @@ type: 'changeset', |
var test = require('tape') | ||
var path = require('path') | ||
var tmpdir = require('os').tmpdir() | ||
var osmdb = require('osm-p2p') | ||
var osmdb = require('../lib/test_db') | ||
@@ -9,3 +7,3 @@ var createGetChanges = require('../../api/get_changes') | ||
var osm = osmdb(path.join(tmpdir, 'osm-p2p-server-test-' + Math.random())) | ||
var osm = osmdb() | ||
var getChanges = createGetChanges(osm) | ||
@@ -12,0 +10,0 @@ |
var test = require('tape') | ||
var path = require('path') | ||
var tmpdir = require('os').tmpdir() | ||
var osmdb = require('osm-p2p') | ||
var osmdb = require('../lib/test_db') | ||
@@ -74,3 +72,3 @@ var createGetElement = require('../../api/get_element') | ||
t.plan(3) | ||
var osm = osmdb(path.join(tmpdir, 'osm-p2p-server-test-' + Math.random())) | ||
var osm = osmdb() | ||
var getElement = createGetElement(osm) | ||
@@ -77,0 +75,0 @@ getElement(12345, 'A', (err, elements) => { |
var test = require('tape') | ||
var hyperlog = require('hyperlog') | ||
var memdb = require('memdb') | ||
var path = require('path') | ||
var fdstore = require('fd-chunk-store') | ||
var memstore = require('memory-chunk-store') | ||
var osmdb = require('osm-p2p-db') | ||
@@ -14,3 +13,2 @@ var http = require('http') | ||
var tmpdir = require('os').tmpdir() | ||
var createServer = require('./lib/test_server.js') | ||
@@ -22,7 +20,6 @@ var slowdb = require('./lib/slowdb.js') | ||
function createOsm () { | ||
var storefile = path.join(tmpdir, 'osm-store-' + Math.random()) | ||
return osmdb({ | ||
log: hyperlog(memdb(), { valueEncoding: 'json' }), | ||
db: DELAY ? slowdb({delay: DELAY}) : memdb(), | ||
store: fdstore(4096, storefile) | ||
store: memstore(4096) | ||
}) | ||
@@ -29,0 +26,0 @@ } |
@@ -5,9 +5,7 @@ // TODO: We are not tracking versions in this test or the original code, | ||
var test = require('tape') | ||
var tmpdir = require('os').tmpdir() | ||
var path = require('path') | ||
var osmdb = require('osm-p2p') | ||
var osmdb = require('./test_db') | ||
var filterSafeDeletes = require('../../lib/filter_deletes') | ||
var osm = osmdb(path.join(tmpdir, 'osm-p2p-server-test-' + Math.random())) | ||
var osm = osmdb() | ||
@@ -14,0 +12,0 @@ test('filterSafeDeletes: setup db', t => { |
@@ -1,10 +0,6 @@ | ||
var tmpdir = require('os').tmpdir() | ||
var path = require('path') | ||
var http = require('http') | ||
var rimraf = require('rimraf') | ||
var mkdirp = require('mkdirp') | ||
var osmdb = require('osm-p2p-db') | ||
var memdb = require('memdb') | ||
var hyperlog = require('hyperlog') | ||
var fdstore = require('fd-chunk-store') | ||
var memstore = require('memory-chunk-store') | ||
@@ -17,9 +13,6 @@ var osmrouter = require('../../') | ||
function testServer (cb) { | ||
var dir = path.join(tmpdir, 'osm-p2p-server-test-' + Math.random()) | ||
mkdirp.sync(dir) | ||
var osm = osmdb({ | ||
db: DELAY ? slowdb({delay: DELAY}) : memdb(), | ||
log: hyperlog(memdb(), { valueEncoding: 'json' }), | ||
store: fdstore(4096, path.join(dir, 'kdb')) | ||
store: memstore(4096) | ||
}) | ||
@@ -37,3 +30,2 @@ var router = osmrouter(osm) | ||
server.close() | ||
rimraf.sync(dir) | ||
cb() | ||
@@ -40,0 +32,0 @@ } |
var test = require('tape') | ||
var tmpdir = require('os').tmpdir() | ||
var path = require('path') | ||
var osmdb = require('osm-p2p') | ||
var osmdb = require('./test_db') | ||
var validateChangeset = require('../../lib/validate_changeset') | ||
var osm = osmdb(path.join(tmpdir, 'osm-p2p-server-test-' + Math.random())) | ||
var osm = osmdb() | ||
@@ -10,0 +8,0 @@ var versions = {} |
201510
15
84
5685
4