osm-p2p-server
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -16,2 +16,3 @@ var collect = require('collect-stream') | ||
} | ||
opts.observations = true | ||
opts.forks = opts.forks || false | ||
@@ -18,0 +19,0 @@ opts.order = 'type' |
@@ -5,2 +5,4 @@ var contentType = require('content-type') | ||
var JSONStream = require('JSONStream') | ||
var through = require('through2') | ||
var pumpify = require('pumpify') | ||
@@ -58,5 +60,20 @@ var version = require('../package.json').version | ||
var close = '\n ' + openClose[1] | ||
return JSONStream.stringify(open, SEP, close) | ||
var stream = pumpify.obj() | ||
var stringify = JSONStream.stringify(open, SEP, close) | ||
stream.setPipeline(convertObservationStream(), stringify) | ||
return stream | ||
} | ||
function convertObservationStream () { | ||
return through.obj(function (doc, enc, next) { | ||
// observations need to be converted nodes for iD editor to draw | ||
// them correctly. | ||
if (doc.type === 'observation') { | ||
// KM: this may not be necessary | ||
doc = Object.assign({}, doc, { type: 'node' }) | ||
} | ||
return next(null, doc) | ||
}) | ||
} | ||
/** | ||
@@ -103,3 +120,4 @@ * Sort function to sort forks by most recent first, or by version id | ||
cmpFork: cmpFork, | ||
OsmJSONStream: OsmJSONStream | ||
OsmJSONStream: OsmJSONStream, | ||
convertObservationStream: convertObservationStream | ||
} |
{ | ||
"name": "osm-p2p-server", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Peer-to-peer OpenStreetMap API v0.6 Server", | ||
@@ -45,3 +45,3 @@ "main": "index.js", | ||
"mkdirp": "~0.5.1", | ||
"obj2osm": "^2.0.0", | ||
"obj2osm": "^2.0.1", | ||
"once": "^1.3.3", | ||
@@ -66,2 +66,3 @@ "osm-p2p-defork": "^1.0.0", | ||
"express": "^4.14.0", | ||
"mapeo-schema": "^1.8.0", | ||
"hyperquest": "^2.0.0", | ||
@@ -68,0 +69,0 @@ "isostring": "0.0.1", |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
var toOsm = require('obj2osm') | ||
var toOsm = require('../lib/obj2osm') | ||
@@ -8,0 +8,0 @@ module.exports = function (req, res, api, params, next) { |
var collect = require('collect-stream') | ||
var osm2Obj = require('osm2obj') | ||
var toOsm = require('obj2osm') | ||
var fromArray = require('from2-array') | ||
var osm2Obj = require('../lib/osm2obj') | ||
var toOsm = require('../lib/obj2osm') | ||
var errors = require('../errors') | ||
@@ -16,3 +16,3 @@ var isValidContentType = require('../lib/util').isValidContentType | ||
var r = req.pipe(osm2Obj({coerceIds: false})) | ||
var r = req.pipe(osm2Obj(api, {coerceIds: false})) | ||
collect(r, function (err, changes) { | ||
@@ -19,0 +19,0 @@ if (err || !changes.length) return next(new errors.XmlParseError(err)) |
var collect = require('collect-stream') | ||
var osm2Obj = require('osm2obj') | ||
var osm2Obj = require('../lib/osm2obj') | ||
var isValidContentType = require('../lib/util').isValidContentType | ||
@@ -12,3 +12,3 @@ var errors = require('../errors') | ||
var r = req.pipe(osm2Obj({coerceIds: false})) | ||
var r = req.pipe(osm2Obj(api, {coerceIds: false})) | ||
collect(r, function (err, ops) { | ||
@@ -15,0 +15,0 @@ if (err || !ops.length) return next(new errors.XmlParseError(err)) |
@@ -1,2 +0,2 @@ | ||
var toOsm = require('obj2osm') | ||
var toOsm = require('../lib/obj2osm') | ||
var fromArray = require('from2-array') | ||
@@ -3,0 +3,0 @@ |
var qs = require('query-string') | ||
var toOsm = require('obj2osm') | ||
var toOsm = require('../lib/obj2osm') | ||
var fromArray = require('from2-array') | ||
@@ -4,0 +4,0 @@ |
var qs = require('query-string') | ||
var fromArray = require('from2-array') | ||
var toOsm = require('obj2osm') | ||
var toOsm = require('../lib/obj2osm') | ||
var cmpFork = require('../lib/util').cmpFork | ||
@@ -6,0 +6,0 @@ |
var Readable = require('readable-stream').Readable | ||
var toOsm = require('obj2osm') | ||
var toOsm = require('../lib/obj2osm') | ||
@@ -4,0 +4,0 @@ module.exports = function (req, res, api, params, next) { |
var qs = require('query-string') | ||
var toOsm = require('obj2osm') | ||
var toOsm = require('../lib/obj2osm') | ||
var accepts = require('accepts') | ||
@@ -4,0 +4,0 @@ |
@@ -11,2 +11,7 @@ var test = require('tape') | ||
{ | ||
type: 'observation', | ||
lon: 2, | ||
lat: 1 | ||
}, | ||
{ | ||
type: 'node', | ||
@@ -82,4 +87,6 @@ lon: 0, | ||
if (!node) return done(keys) | ||
node.changeset = changesetId | ||
node.timestamp = (new Date()).toISOString() | ||
if (node.type === 'node') { | ||
node.changeset = changesetId | ||
node.timestamp = (new Date()).toISOString() | ||
} | ||
osm.create(node, function (err, key) { | ||
@@ -86,0 +93,0 @@ if (err) return done(err) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
214605
87
6074
18
6
Updatedobj2osm@^2.0.1