New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tilelive

Package Overview
Dependencies
Maintainers
5
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tilelive - npm Package Compare versions

Comparing version 4.4.3 to 4.5.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 4.5.0
* Bug fixes.
* Removes underscore, step dependencies.
## 4.4.0

@@ -2,0 +7,0 @@

70

lib/copytask.js
var tilelive = require('..');
var url = require('url');
var fs = require('fs');
var Step = require('step');
var Scheme = require('./scheme');

@@ -118,38 +117,39 @@

Step(function() {
if (task.source) return this(null, task.source);
tilelive.load(task.from, this);
}, function(err, source) {
if (err) throw err;
task.source = source;
source.getInfo(this);
}, function(err, info) {
if (err) throw err;
// @TODO the tilelive API currently has no standard way
// of determining whether a tilesource has tiles, grids
// or both. See issue #44.
task.formats.push('tile');
var init = function() {
if (!task.source) return tilelive.load(task.from, function(err, source) {
if (err) return callback(err);
task.source = source;
init();
});
if (!task.formats.length) return task.source.getInfo(function(err, info) {
if (err) return callback(err);
// @TODO the tilelive API currently has no standard way
// of determining whether a tilesource has tiles, grids
// or both. See issue #44.
task.formats.push('tile');
// Use template as an indicator that grids are present.
if (info.template) {
task.formats.push('grid');
task.stats.total = (task.stats.total || 0) * 2;
}
init();
});
if (!task.sink) return tilelive.load(task.to, function(err, sink) {
if (err) return callback(err);
task.sink = sink;
init();
});
task.sink.startWriting(function(err) {
if (err) return callback();
// Use template as an indicator that grids are present.
if (info.template) {
task.formats.push('grid');
task.stats.total = (task.stats.total || 0) * 2;
}
if (task.sink) return this(null, task.sink);
tilelive.load(task.to, this);
}, function(err, sink) {
if (err) throw err;
task.sink = sink;
task.sink.startWriting(this);
}, function(err) {
if (err) return callback(err);
// It is possible for a CopyTask to be paused before it
// ever starts (SIGINT, exceptions, etc.) In these cases
// respect the pause rather than forging ahead.
if (task.pausing) return callback(null);
// It is possible for a CopyTask to be paused before it
// ever starts (SIGINT, exceptions, etc.) In these cases
// respect the pause rather than forging ahead.
if (task.pausing) return callback(null);
task.scheme.start();
callback(null);
});
task.scheme.start();
callback(null);
});
};
init();
};

@@ -156,0 +156,0 @@

var tilelive = exports;
var _ = require('underscore');
var path = require('path');

@@ -9,3 +8,2 @@ var url = require('url');

var EventEmitter = require('events').EventEmitter;
var Step = require('step');
var CopyTask = require('./copytask');

@@ -46,17 +44,15 @@ var Scheme = require('./scheme');

Step(function() {
var group = this.group();
for (var name in tilelive.protocols) {
tilelive.protocols[name].list(source, group());
}
}, function(err, uris) {
if (err) return callback(err);
// Combine lists from all protocol sources, eliminating duplicate IDs.
var result = {};
for (var i = 0; i < uris.length; i++) {
_.defaults(result, uris[i]);
}
callback(null, result);
});
var result = {};
var queue = Object.keys(tilelive.protocols);
var load = function() {
if (!queue.length) return callback(null, result);
tilelive.protocols[queue.shift()].list(source, function(err, uris) {
if (err) return callback(err);
if (uris) for (var key in uris) {
if (result[key] == null) result[key] = uris[key];
}
load();
});
};
load();
};

@@ -116,3 +112,5 @@

if (data) {
_(data).defaults(tilelive.defaults);
for (var key in tilelive.defaults) {
if (data[key] == null) data[key] = tilelive.defaults[key];
}
callback(err, data, handler);

@@ -134,24 +132,22 @@ } else {

var handlers = [], models = [];
tilelive.list(source, function(err, uris) {
if (err) return callback(err);
if (!uris) return callback(null, []);
if (!uris || !Object.keys(uris).length) return callback(null, []);
Step(function() {
var group = this.group();
for (var id in uris) {
var next = group();
tilelive.info(uris[id], function(err, data, handler) {
if (!err && data && handler) {
models.push(data);
handlers.push(handler);
}
next(err);
});
}
}, function(err) {
if (err) console.error(err.stack);
var sorted = _.sortBy(_.zip(models, handlers), function(m) { return (m[0].name || m[0].id).toLowerCase(); });
callback(null, _(sorted).pluck(0), _(sorted).pluck(1));
});
var result = [];
var remaining = Object.keys(uris).length;
for (var id in uris) {
tilelive.info(uris[id], function(err, data, handler) {
if (err) console.error(err.stack);
if (!err && data && handler) result.push([data, handler]);
if (!--remaining) {
result.sort(function(a, b) {
return (a[0].name||a[0].id).toLowerCase() < (b[0].name||b[0].id).toLowerCase() ? -1 : 1;
});
var models = result.map(function(r) { return r[0] });
var handlers = result.map(function(r) { return r[1] });
callback(null, models, handlers);
}
});
}
});

@@ -158,0 +154,0 @@ };

{
"name" : "tilelive",
"version" : "4.4.3",
"version" : "4.5.0",
"main" : "./lib/tilelive.js",

@@ -29,5 +29,3 @@ "description" : "Frontend for various tile backends, mapnik and mbtiles",

"optimist": "~0.3.1",
"step": "~0.0.5",
"sphericalmercator": "~1.0.1",
"underscore": "~1.3.3"
"sphericalmercator": "~1.0.1"
},

@@ -34,0 +32,0 @@ "devDependencies": {

@@ -1,2 +0,1 @@

var Step = require('step');
var assert = require('assert');

@@ -47,2 +46,6 @@ var fs = require('fs');

if (err) throw err;
// There is some variance in the MBTiles size generated --
// possibly related to the timing in which data is inserted.
assert.ok(info.filesize > 39900 && info.filesize < 41000);
delete info.filesize;
assert.deepEqual({

@@ -52,3 +55,3 @@ scheme: 'tms',

id: 'copy',
filesize: 39936,
// filesize: 39936,
minzoom: 3,

@@ -55,0 +58,0 @@ maxzoom: 4,

var assert = require('assert');
var Step = require('step');

@@ -158,9 +157,10 @@ var tilelive = require('..');

Step(function() {
for (var i = 0; i < handlers.length; i++) {
handlers[i].close(this.parallel());
}
}, done);
var doit = function(err) {
if (err) return done(err);
if (!handlers.length) return done();
handlers.shift().close(doit);
};
doit();
});
});
});

@@ -1,2 +0,1 @@

var Step = require('step');
var assert = require('assert');

@@ -3,0 +2,0 @@ var fs = require('fs');

Sorry, the diff of this file is not supported yet

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