Compare commits

...

84 Commits

Author SHA1 Message Date
Raul Ochoa
a9275845ff Release 2.61.0 2016-07-06 18:11:31 +02:00
Raul Ochoa
e5bf9efdb9 Upgrades camshaft to 0.33.2 2016-07-06 18:11:01 +02:00
Raul Ochoa
85073345ec Merge pull request #545 from CartoDB/turbo-carto-multiple-errors
Turbo carto multiple errors
2016-07-06 12:56:12 +02:00
Raul Ochoa
80d5b29902 More clear turbo-carto error messages: no context in message 2016-07-06 12:34:09 +02:00
Raul Ochoa
f55b748d20 Upgrade turbo-carto to 0.14.0 2016-07-06 12:33:08 +02:00
Raul Ochoa
870468ddf7 Merge pull request #543 from CartoDB/turbo-carto-multiple-errors
Return multiple turbo-carto errors
2016-07-06 00:43:00 +02:00
Raul Ochoa
b3107916ce Return multiple turbo-carto errors
Closes #541
2016-07-06 00:32:30 +02:00
Raul Ochoa
9cf856ab78 Merge pull request #542 from CartoDB/upgrade-turbo-carto
Upgrades turbo-carto to 0.13.0
2016-07-05 19:59:06 +02:00
Raul Ochoa
bbd047a940 Upgrades turbo-carto to 0.13.0 2016-07-05 19:53:13 +02:00
Daniel García Aubert
d3dfb0a7ff Stubs next version 2016-07-05 19:24:26 +02:00
Daniel García Aubert
5a8f9db79c Release 2.60.0 2016-07-05 18:39:20 +02:00
Daniel García Aubert
fbe20386b6 Upgrades camshaft version to 0.32.0 2016-07-05 18:31:47 +02:00
Raul Ochoa
6245b40015 Stubs next version 2016-07-05 15:51:36 +02:00
Raul Ochoa
3e959d8dc0 Release 2.59.1 2016-07-05 15:50:57 +02:00
Raul Ochoa
564df920d1 Upgrades camshaft to 0.31.0 2016-07-05 15:50:31 +02:00
Raul Ochoa
7e2c467a4f Stubs next version 2016-07-05 15:25:38 +02:00
Raul Ochoa
3a42305408 Release 2.59.0 2016-07-05 15:25:00 +02:00
Raul Ochoa
09616777e6 Merge pull request #540 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.30.0
2016-07-05 15:24:05 +02:00
Raul Ochoa
c2a5569b8c Upgrades camshaft to 0.30.0 2016-07-05 14:59:09 +02:00
Raul Ochoa
38bea2108b Stubs next version 2016-07-05 12:16:35 +02:00
Raul Ochoa
ab0777b45f Release 2.58.0 2016-07-05 12:15:55 +02:00
Raul Ochoa
962f94387b Fix release date 2016-07-05 12:15:41 +02:00
Raul Ochoa
de5600b4fd Bump version 2016-07-05 12:15:09 +02:00
Raul Ochoa
188a202f02 Merge pull request #538 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.29.2
2016-07-05 12:14:20 +02:00
Raul Ochoa
19f39b87f5 Merge branch 'master' into upgrade-camshaft
Conflicts:
	NEWS.md
2016-07-05 11:42:57 +02:00
Raul Ochoa
c759f314f9 Merge pull request #539 from CartoDB/nodes-metadata-fix
Return full list of nodes in response metadata
2016-07-05 11:42:13 +02:00
Raul Ochoa
6c98f14c64 Return full list of nodes in response metadata 2016-07-05 11:26:52 +02:00
Raul Ochoa
f2348e1b24 Upgrades camshaft to 0.29.2 2016-07-05 11:25:24 +02:00
Raul Ochoa
4b5a10fe61 Upgrades camshaft to 0.29.1 2016-07-05 10:26:48 +02:00
Raul Ochoa
163fa58b5a Merge pull request #537 from CartoDB/analysis-failed-status-error-message
Include error message in node status endpoint
2016-07-05 10:22:43 +02:00
Raul Ochoa
b3bbb6af01 Include error message in node status endpoint 2016-07-04 18:40:11 +02:00
Raul Ochoa
28d711e1f4 Stubs next version 2016-07-04 17:54:39 +02:00
Raul Ochoa
410fdb8343 Release 2.57.0 2016-07-04 17:53:58 +02:00
Raul Ochoa
21c2f3bdd1 Merge pull request #536 from CartoDB/upgrade-camshaft
Upgrade camshaft to 0.28.1
2016-07-04 17:53:20 +02:00
Raul Ochoa
baae080318 Merge remote-tracking branch 'origin/master' into upgrade-camshaft
Conflicts:
	NEWS.md
	package.json
2016-07-04 17:04:54 +02:00
Raul Ochoa
81c0796056 Upgrades camshaft to 0.28.1 2016-07-04 17:03:56 +02:00
Daniel García Aubert
6ea5c5f414 Stubs next version 2016-07-04 16:29:30 +02:00
Daniel García Aubert
7e37705843 Release 2.56.0 2016-07-04 16:08:38 +02:00
Daniel García Aubert
425b5e6b4a Upgrades camshaft version to 0.27.0 2016-07-04 15:56:04 +02:00
Raul Ochoa
8942c72fb2 Stubs next version 2016-07-04 10:28:44 +02:00
Raul Ochoa
e9359fdd73 Release 2.55.0 2016-07-04 10:28:07 +02:00
Raul Ochoa
5c4308abc1 Merge pull request #534 from CartoDB/turbo-carto-valid-ramps
Skip null values for quantification methods
2016-07-04 02:30:23 +02:00
Raul Ochoa
61576b671b Update news 2016-07-04 02:23:48 +02:00
Raul Ochoa
1e4d6bb942 Merge remote-tracking branch 'origin/master' into turbo-carto-valid-ramps 2016-07-04 02:22:41 +02:00
Raul Ochoa
ff6c0addb4 Merge pull request #533 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.26.0
2016-07-04 02:22:24 +02:00
Raul Ochoa
98cd524c07 Skip null values for quantification methods generating null values 2016-07-04 02:15:54 +02:00
Raul Ochoa
746d57ff42 Red: expose issues with some quantification method when query returns empty 2016-07-04 02:11:52 +02:00
Raul Ochoa
7319822419 Upgrades camshaft to 0.26.0 2016-07-04 02:07:12 +02:00
Raul Ochoa
58bcde3818 Merge pull request #532 from CartoDB/upgrade-camshaft
Upgrade camshaft to 0.25.0
2016-07-03 11:51:56 +02:00
Raul Ochoa
b57d08f38e Output nodes for test 2016-07-03 11:45:10 +02:00
Raul Ochoa
739a8cef32 Regenerate npm-shrinkwrap.json for 0.25.0 2016-07-03 11:27:04 +02:00
Raul Ochoa
8a6e31e025 Merge remote-tracking branch 'origin/master' into upgrade-camshaft 2016-07-03 10:59:12 +02:00
Raul Ochoa
616aac9771 Upgrade camshaft to 0.25.0
Use new configuration with user for nodes.
2016-07-03 10:49:45 +02:00
Raul Ochoa
23a1b7484e Merge pull request #531 from CartoDB/pg-9.5
Use postgresql 9.5 in travis
2016-07-02 20:05:55 +02:00
Raul Ochoa
9624ee1c76 Attempt to use postgresql 9.5 2016-07-02 19:54:34 +02:00
Raul Ochoa
4c557be2c2 Update to use latest cdb_analysis_catalog
It avoids to execute queries that are extension specifics
2016-07-02 19:50:59 +02:00
Raul Ochoa
7577ee8015 Stubs next version 2016-07-01 20:17:11 +02:00
Daniel García Aubert
8c73914da4 Release 2.54.0 2016-06-30 15:00:21 +02:00
Raul Ochoa
604ba300aa Bump version 2016-06-30 13:33:54 +02:00
Raul Ochoa
876166ab74 Update news 2016-06-30 13:33:25 +02:00
Raul Ochoa
1bf8fda770 Merge pull request #530 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.23.0
2016-06-30 13:31:01 +02:00
Raul Ochoa
cd32218cea Upgrades camshaft to 0.23.0 2016-06-30 13:14:30 +02:00
Daniel
0fd0974738 Merge pull request #525 from CartoDB/fix-error-context
Fix error context, replaced `turbo-carto` error type by `layer` type
2016-06-29 19:15:44 +02:00
Daniel García Aubert
ed7f95a1a7 Merge branch 'master' into fix-error-context 2016-06-29 19:02:54 +02:00
Daniel García Aubert
a36c1c52ae Fixs typo 2016-06-29 17:19:01 +02:00
Daniel García Aubert
226d948c4d Upgrades windshaft to version 2.4.0 2016-06-29 17:08:55 +02:00
Raul Ochoa
84c67f977e Stubs next version 2016-06-29 16:50:19 +02:00
Raul Ochoa
c09cda84a3 Release 2.53.5 2016-06-29 16:49:34 +02:00
Raul Ochoa
bd36ea1829 news style 2016-06-29 16:49:13 +02:00
Raul Ochoa
01a47925e0 Merge pull request #529 from CartoDB/528-invalid-error-regression
Fixes invalid error on node not found from dataview
2016-06-29 16:47:16 +02:00
Raul Ochoa
dd8a70eb95 Uses node list so identical nodes are not de-duplicated and can be used with different ids
Fixes #528
2016-06-29 16:10:26 +02:00
Raul Ochoa
013bdba4ff Add regression test wheren node id can't be found and it should 2016-06-29 16:08:38 +02:00
Raul Ochoa
c1acc54d55 Add constants for cartocss symbolizers 2016-06-29 16:07:42 +02:00
Raul Ochoa
5f3fb6e5f7 Adds fake CDB_KMeans function 2016-06-29 16:07:01 +02:00
Daniel García Aubert
e3fac9c161 Updated NEWS 2016-06-29 16:03:52 +02:00
Daniel García Aubert
accab9e78a Gets layerId from the layer that raises the error 2016-06-29 12:21:15 +02:00
Raul Ochoa
cb53d140e3 Stubs next version 2016-06-28 19:48:47 +02:00
Raul Ochoa
72986d1946 Release 2.53.4 2016-06-28 19:47:59 +02:00
Raul Ochoa
2195c55518 Upgrades camshaft to 0.22.4 2016-06-28 19:44:55 +02:00
Raul Ochoa
c418ba1908 Stubs next version 2016-06-28 14:39:02 +02:00
Raul Ochoa
934356e5cc Release 2.53.3 2016-06-28 14:38:25 +02:00
Raul Ochoa
c40235a910 Upgrades camshaft to 0.22.3 2016-06-28 14:37:21 +02:00
Raul Ochoa
cd8338196e Stubs next version 2016-06-28 13:08:08 +02:00
Daniel García Aubert
016adb64ef Fix error context, replaced turbo-carto error type by layer type. Context is no longer used, custom property for each type will be used instead. 2016-06-26 18:43:04 +02:00
24 changed files with 591 additions and 206 deletions

View File

@@ -1,10 +1,6 @@
sudo: false
addons:
postgresql: "9.4"
apt:
packages:
- postgresql-plpython-9.4
- pkg-config
- libcairo2-dev
- libjpeg8-dev
@@ -12,6 +8,17 @@ addons:
before_install:
- npm install -g npm@2
- lsb_release -a
- sudo mv /etc/apt/sources.list.d/pgdg-source.list* /tmp
- sudo apt-get -qq purge postgis* postgresql*
- sudo rm -Rf /var/lib/postgresql /etc/postgresql
- sudo apt-add-repository --yes ppa:cartodb/postgresql-9.5
- sudo apt-add-repository --yes ppa:cartodb/gis
- sudo apt-get update
- sudo apt-get install -q postgresql-9.5-postgis-2.2
- sudo apt-get install -q postgresql-plpython-9.5
- echo -e "local\tall\tall\ttrust\nhost\tall\tall\t127.0.0.1/32\ttrust\nhost\tall\tall\t::1/128\ttrust" |sudo tee /etc/postgresql/9.5/main/pg_hba.conf
- sudo service postgresql restart
- createdb template_postgis
- createuser publicuser
- psql -c "CREATE EXTENSION postgis" template_postgis

112
NEWS.md
View File

@@ -1,5 +1,116 @@
# Changelog
## 2.61.0
Released 2016-07-06
Enhancements:
- More clear turbo-carto error messages: no context in message.
- Return multiple turbo-carto errors #541.
Announcements:
- Upgrades turbo-carto to [0.14.0](https://github.com/CartoDB/turbo-carto/releases/tag/0.14.0).
- Upgrades camshaft to [0.33.2](https://github.com/CartoDB/camshaft/releases/tag/0.33.2).
## 2.60.0
Released 2016-07-05
Announcements:
- Upgrades camshaft to [0.32.0](https://github.com/CartoDB/camshaft/releases/tag/0.32.0).
## 2.59.1
Released 2016-07-05
Announcements:
- Upgrades camshaft to [0.31.0](https://github.com/CartoDB/camshaft/releases/tag/0.31.0).
## 2.59.0
Released 2016-07-05
Announcements:
- Upgrades camshaft to [0.30.0](https://github.com/CartoDB/camshaft/releases/tag/0.30.0).
## 2.58.0
Released 2016-07-05
Announcements:
- Upgrades camshaft to [0.29.2](https://github.com/CartoDB/camshaft/releases/tag/0.29.2).
Bug fixes:
- Return full list of nodes in response metadata.
## 2.57.0
Released 2016-07-04
Announcements:
- Upgrades camshaft to [0.28.1](https://github.com/CartoDB/camshaft/releases/tag/0.28.1).
## 2.56.0
Released 2016-07-04
Announcements:
- Upgrades camshaft to [0.27.0](https://github.com/CartoDB/camshaft/releases/tag/0.27.0).
## 2.55.0
Released 2016-07-04
Enhancements:
- Skip null values for quantification methods generating null values.
Announcements:
- Uses new configuration for camshaft: analysis node has an associated user/owner.
- Upgrades camshaft to [0.26.0](https://github.com/CartoDB/camshaft/releases/tag/0.26.0).
## 2.54.0
Released 2016-06-30
Improvements:
- Errors with context: replaced `turbo-carto` error type by `layer` type.
Announcements:
- Upgrades camshaft to [0.23.0](https://github.com/CartoDB/camshaft/releases/tag/0.23.0)
## 2.53.5
Released 2016-06-29
Bug fixes:
- Uses node list so identical nodes are not de-duplicated and can be used with different ids #528.
## 2.53.4
Released 2016-06-28
Announcements:
- Upgrades camshaft to [0.22.4](https://github.com/CartoDB/camshaft/releases/tag/0.22.4)
## 2.53.3
Released 2016-06-28
Announcements:
- Upgrades camshaft to [0.22.3](https://github.com/CartoDB/camshaft/releases/tag/0.22.3)
## 2.53.2
Released 2016-06-28
@@ -39,6 +150,7 @@ Released 2016-06-21
Enhancements:
- Split turbo-carto adapter substitutions tokens query.
- Now errors with context have the same schema. #519
- Responses with error now return the layer-id to give more info to the user.
Announcements:
- Upgrades camshaft to [0.20.0](https://github.com/CartoDB/camshaft/releases/tag/0.20.0)

View File

@@ -9,7 +9,10 @@ module.exports = AnalysisStatusBackend;
AnalysisStatusBackend.prototype.getNodeStatus = function (params, callback) {
var nodeId = params.nodeId;
var statusQuery = 'SELECT node_id, status, updated_at FROM cdb_analysis_catalog where node_id = \'' + nodeId + '\'';
var statusQuery = [
'SELECT node_id, status, updated_at, last_error_message as error_message',
'FROM cdb_analysis_catalog where node_id = \'' + nodeId + '\''
].join(' ');
var pg = new PSQL(dbParamsFromReqParams(params));
pg.query(statusQuery, function(err, result) {
@@ -21,10 +24,16 @@ AnalysisStatusBackend.prototype.getNodeStatus = function (params, callback) {
var rows = result.rows || [];
return callback(null, rows[0] || {
var statusResponse = rows[0] || {
node_id: nodeId,
status: 'unknown'
});
};
if (statusResponse.status !== 'failed') {
delete statusResponse.error_message;
}
return callback(null, statusResponse);
}, true); // use read-only transaction
};

View File

@@ -56,6 +56,7 @@ DataviewBackend.prototype.getDataview = function (mapConfigProvider, user, param
assert.ifError(err);
var analysisConfiguration = {
user: user,
db: {
host: params.dbhost,
port: params.dbport,
@@ -85,7 +86,7 @@ DataviewBackend.prototype.getDataview = function (mapConfigProvider, user, param
sourceId2Node[rootNode.params.id] = rootNode;
}
analysis.getSortedNodes().forEach(function(node) {
analysis.getNodes().forEach(function(node) {
if (node.params && node.params.id) {
sourceId2Node[node.params.id] = node;
}
@@ -201,6 +202,7 @@ DataviewBackend.prototype.search = function (mapConfigProvider, user, params, ca
assert.ifError(err);
var analysisConfiguration = {
user: user,
db: {
host: params.dbhost,
port: params.dbport,
@@ -232,7 +234,7 @@ DataviewBackend.prototype.search = function (mapConfigProvider, user, params, ca
sourceId2Node[rootNode.params.id] = rootNode;
}
analysis.getSortedNodes().forEach(function(node) {
analysis.getNodes().forEach(function(node) {
if (node.params && node.params.id) {
sourceId2Node[node.params.id] = node;
}

View File

@@ -84,6 +84,10 @@ PostgresDatasource.prototype.getRamp = function (column, buckets, method, callba
var strategy = method2strategy[methodName];
var ramp = result[0][methodName] || [];
// Skip null values from ramp
// Generated turbo-carto won't be correct, but better to keep it working than failing
// TODO fix cartodb-postgres extension quantification functions
ramp = ramp.filter(function(value) { return value !== null; });
if (strategy !== STRATEGY.EXACT) {
ramp = ramp.sort(function(a, b) {
return a - b;

View File

@@ -242,11 +242,19 @@ function errorMessageWithContext(err) {
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/68
var message = (_.isString(err) ? err : err.message) || 'Unknown error';
return {
var error = {
type: err.type || 'unknown',
message: stripConnectionInfo(message),
context: err.context || 'unknown'
};
for (var prop in err) {
// type & message are properties from Error's prototype and will be skipped
if (err.hasOwnProperty(prop)) {
error[prop] = err[prop];
}
}
return error;
}
module.exports.errorMessage = errorMessage;

View File

@@ -135,6 +135,7 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
function prepareAdapterMapConfig(err, requestMapConfig) {
assert.ifError(err);
context.analysisConfiguration = {
user: req.context.user,
db: {
host: req.params.dbhost,
port: req.params.dbport,
@@ -329,7 +330,7 @@ function getLastUpdatedTime(analysesResults, lastUpdateTime) {
return lastUpdateTime;
}
return analysesResults.reduce(function(lastUpdateTime, analysis) {
return analysis.getSortedNodes().reduce(function(lastNodeUpdatedAtTime, node) {
return analysis.getNodes().reduce(function(lastNodeUpdatedAtTime, node) {
var nodeUpdatedAtDate = node.getUpdatedAt();
var nodeUpdatedTimeAt = (nodeUpdatedAtDate && nodeUpdatedAtDate.getTime()) || 0;
return nodeUpdatedTimeAt > lastNodeUpdatedAtTime ? nodeUpdatedTimeAt : lastNodeUpdatedAtTime;
@@ -343,7 +344,7 @@ function addAnalysesMetadata(username, layergroup, analysesResults, includeQuery
layergroup.metadata.analyses = [];
analysesResults.forEach(function(analysis) {
var nodes = analysis.getSortedNodes();
var nodes = analysis.getNodes();
layergroup.metadata.analyses.push({
nodes: nodes.reduce(function(nodesIdMap, node) {
if (node.params.id) {

View File

@@ -58,14 +58,12 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function(user, requestMapConfi
requestMapConfig = appendFiltersToNodes(requestMapConfig, dataviewsFiltersBySourceId);
function createAnalysis(analysisDefinition, index, done) {
function createAnalysis(analysisDefinition, done) {
self.analysisBackend.create(analysisConfiguration, analysisDefinition, function (err, analysis) {
if (err) {
var error = new Error(err.message);
error.type = 'analysis';
error.context = {};
error.context.layer = {
index: index,
error.analysis = {
id: analysisDefinition.id,
type: analysisDefinition.type
};
@@ -77,8 +75,8 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function(user, requestMapConfi
}
var analysesQueue = queue(requestMapConfig.analyses.length);
requestMapConfig.analyses.forEach(function(analysis, index) {
analysesQueue.defer(createAnalysis, analysis, index);
requestMapConfig.analyses.forEach(function(analysis) {
analysesQueue.defer(createAnalysis, analysis);
});
analysesQueue.awaitAll(function(err, analysesResults) {
@@ -92,7 +90,7 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function(user, requestMapConfi
sourceId2Query[rootNode.params.id] = rootNode;
}
analysis.getSortedNodes().forEach(function(node) {
analysis.getNodes().forEach(function(node) {
if (node.params && node.params.id) {
sourceId2Query[node.params.id] = node;
}

View File

@@ -9,6 +9,8 @@ var turboCarto = require('turbo-carto');
var SubstitutionTokens = require('../../../utils/substitution-tokens');
var PostgresDatasource = require('../../../backends/turbo-carto-postgres-datasource');
var MapConfig = require('windshaft').model.MapConfig;
function TurboCartoAdapter() {
}
@@ -26,15 +28,26 @@ TurboCartoAdapter.prototype.getMapConfig = function (user, requestMapConfig, par
var parseCartoQueue = queue(layers.length);
layers.forEach(function(layer, index) {
parseCartoQueue.defer(self._parseCartoCss.bind(self), user, params, layer, index);
var layerId = MapConfig.getLayerId(requestMapConfig, index);
parseCartoQueue.defer(self._parseCartoCss.bind(self), user, params, layer, index, layerId);
});
parseCartoQueue.awaitAll(function (err, layers) {
parseCartoQueue.awaitAll(function (err, results) {
if (err) {
return callback(err);
}
requestMapConfig.layers = layers;
var errors = results.reduce(function(errors, result) {
if (result.error) {
errors.push(result.error);
}
return errors;
}, []);
if (errors.length > 0) {
return callback(errors);
}
requestMapConfig.layers = results.map(function(result) { return result.layer; });
return callback(null, requestMapConfig);
});
@@ -65,32 +78,34 @@ var tokensQueryTpl = dot.template([
'from bbox_query, pixel_size_query, scale_denominator_query, zoom_query'
].join('\n'));
TurboCartoAdapter.prototype._parseCartoCss = function (username, params, layer, index, callback) {
TurboCartoAdapter.prototype._parseCartoCss = function (username, params, layer, layerIndex, layerId, callback) {
if (!shouldParseLayerCartocss(layer)) {
return callback(null, layer);
return callback(null, { layer: layer });
}
var pg = new PSQL(dbParamsFromReqParams(params));
function processCallback(err, cartocss) {
// Only return turbo-carto errors
if (err && err.name === 'TurboCartoError') {
var error = new Error('turbo-carto: ' + err.message);
var error = new Error(err.message);
error.http_status = 400;
error.type = 'turbo-carto';
error.context = err.context;
error.context.layer = {
index: index,
type: layer.type
error.type = 'layer';
error.subtype = 'turbo-carto';
error.layer = {
id: layerId,
index: layerIndex,
type: layer.type,
context: err.context
};
return callback(error);
return callback(null, { error: error });
}
// Try to continue in the rest of the cases
if (cartocss) {
layer.options.cartocss = cartocss;
}
return callback(null, layer);
return callback(null, { layer: layer });
}
var layerSql = layer.options.sql;
@@ -100,9 +115,7 @@ TurboCartoAdapter.prototype._parseCartoCss = function (username, params, layer,
var tokensQuery = tokensQueryTpl({_sql: layerRawSql});
return pg.query(tokensQuery, function(err, resultSet) {
if (err) {
var error = new Error('turbo-carto: ' + err.message);
error.type = 'turbo-carto';
return callback(error);
return processCallback(err);
}
resultSet = resultSet || {};

View File

@@ -95,6 +95,7 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
function prepareAdapterMapConfig(err, requestMapConfig) {
assert.ifError(err);
context.analysisConfiguration = {
user: self.owner,
db: {
host: rendererParams.dbhost,
port: rendererParams.dbport,

240
npm-shrinkwrap.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "windshaft-cartodb",
"version": "2.53.2",
"version": "2.61.0",
"dependencies": {
"body-parser": {
"version": "1.14.2",
@@ -52,7 +52,7 @@
"ee-first": {
"version": "1.1.1",
"from": "ee-first@1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
"resolved": "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz"
}
}
},
@@ -105,9 +105,9 @@
}
},
"camshaft": {
"version": "0.22.2",
"from": "camshaft@0.22.2",
"resolved": "https://registry.npmjs.org/camshaft/-/camshaft-0.22.2.tgz",
"version": "0.33.2",
"from": "camshaft@0.33.2",
"resolved": "https://registry.npmjs.org/camshaft/-/camshaft-0.33.2.tgz",
"dependencies": {
"async": {
"version": "1.5.2",
@@ -558,7 +558,7 @@
"debug": {
"version": "2.2.0",
"from": "debug@>=2.2.0 <2.3.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"resolved": "http://registry.npm.taobao.org/debug/download/debug-2.2.0.tgz",
"dependencies": {
"ms": {
"version": "0.7.1",
@@ -676,7 +676,7 @@
"ee-first": {
"version": "1.1.1",
"from": "ee-first@1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
"resolved": "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz"
}
}
},
@@ -742,7 +742,7 @@
"mime": {
"version": "1.3.4",
"from": "mime@1.3.4",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz"
"resolved": "http://registry.npm.taobao.org/mime/download/mime-1.3.4.tgz"
},
"ms": {
"version": "0.7.1",
@@ -786,7 +786,7 @@
"mime": {
"version": "1.3.4",
"from": "mime@1.3.4",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz"
"resolved": "http://registry.npm.taobao.org/mime/download/mime-1.3.4.tgz"
},
"ms": {
"version": "0.7.1",
@@ -866,7 +866,7 @@
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
"resolved": "http://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
@@ -1029,7 +1029,7 @@
},
"mime-types": {
"version": "2.1.11",
"from": "mime-types@>=2.1.2 <2.2.0",
"from": "mime-types@>=2.1.11 <2.2.0",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz",
"dependencies": {
"mime-db": {
@@ -1257,24 +1257,24 @@
"resolved": "https://registry.npmjs.org/step-profiler/-/step-profiler-0.3.0.tgz"
},
"turbo-carto": {
"version": "0.12.1",
"from": "turbo-carto@0.12.1",
"resolved": "https://registry.npmjs.org/turbo-carto/-/turbo-carto-0.12.1.tgz",
"version": "0.14.0",
"from": "turbo-carto@0.14.0",
"resolved": "https://registry.npmjs.org/turbo-carto/-/turbo-carto-0.14.0.tgz",
"dependencies": {
"colorbrewer": {
"version": "1.0.0",
"from": "colorbrewer@1.0.0",
"resolved": "https://registry.npmjs.org/colorbrewer/-/colorbrewer-1.0.0.tgz"
"resolved": "http://registry.npm.taobao.org/colorbrewer/download/colorbrewer-1.0.0.tgz"
},
"cartocolor": {
"version": "1.1.0",
"from": "cartocolor@1.1.0",
"resolved": "https://registry.npmjs.org/cartocolor/-/cartocolor-1.1.0.tgz"
"version": "2.0.2",
"from": "cartocolor@2.0.2",
"resolved": "https://registry.npmjs.org/cartocolor/-/cartocolor-2.0.2.tgz"
},
"es6-promise": {
"version": "3.1.2",
"from": "es6-promise@3.1.2",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.1.2.tgz"
"resolved": "http://registry.npm.taobao.org/es6-promise/download/es6-promise-3.1.2.tgz"
},
"postcss": {
"version": "5.0.19",
@@ -1308,7 +1308,7 @@
"postcss-value-parser": {
"version": "3.3.0",
"from": "postcss-value-parser@3.3.0",
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz"
"resolved": "http://registry.npm.taobao.org/postcss-value-parser/download/postcss-value-parser-3.3.0.tgz"
}
}
},
@@ -1318,9 +1318,9 @@
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
},
"windshaft": {
"version": "2.3.0",
"from": "windshaft@2.3.0",
"resolved": "https://registry.npmjs.org/windshaft/-/windshaft-2.3.0.tgz",
"version": "2.4.0",
"from": "windshaft@2.4.0",
"resolved": "https://registry.npmjs.org/windshaft/-/windshaft-2.4.0.tgz",
"dependencies": {
"abaculus": {
"version": "1.1.0-cdb5",
@@ -2976,6 +2976,11 @@
"from": "ansi@>=0.3.1 <0.4.0",
"resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz"
},
"ansi-regex": {
"version": "2.0.0",
"from": "ansi-regex@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"ansi-styles": {
"version": "2.2.1",
"from": "ansi-styles@>=2.2.1 <3.0.0",
@@ -2986,11 +2991,6 @@
"from": "are-we-there-yet@>=1.1.2 <1.2.0",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz"
},
"ansi-regex": {
"version": "2.0.0",
"from": "ansi-regex@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"asn1": {
"version": "0.2.3",
"from": "asn1@>=0.2.3 <0.3.0",
@@ -3051,26 +3051,26 @@
"from": "combined-stream@>=1.0.5 <1.1.0",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz"
},
"concat-map": {
"version": "0.0.1",
"from": "concat-map@0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
},
"commander": {
"version": "2.9.0",
"from": "commander@>=2.9.0 <3.0.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz"
},
"cryptiles": {
"version": "2.0.5",
"from": "cryptiles@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz"
},
"core-util-is": {
"version": "1.0.2",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
},
"concat-map": {
"version": "0.0.1",
"from": "concat-map@0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
},
"cryptiles": {
"version": "2.0.5",
"from": "cryptiles@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz"
},
"debug": {
"version": "2.2.0",
"from": "debug@>=2.2.0 <2.3.0",
@@ -3096,46 +3096,46 @@
"from": "ecc-jsbn@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz"
},
"escape-string-regexp": {
"version": "1.0.5",
"from": "escape-string-regexp@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
},
"forever-agent": {
"version": "0.6.1",
"from": "forever-agent@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz"
"extend": {
"version": "3.0.0",
"from": "extend@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
},
"extsprintf": {
"version": "1.0.2",
"from": "extsprintf@1.0.2",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz"
},
"form-data": {
"version": "1.0.0-rc4",
"from": "form-data@>=1.0.0-rc3 <1.1.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz"
},
"extend": {
"version": "3.0.0",
"from": "extend@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
},
"fstream": {
"version": "1.0.9",
"from": "fstream@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.9.tgz"
"forever-agent": {
"version": "0.6.1",
"from": "forever-agent@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz"
},
"fstream-ignore": {
"version": "1.0.4",
"from": "fstream-ignore@>=1.0.3 <1.1.0",
"resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.4.tgz"
},
"escape-string-regexp": {
"version": "1.0.5",
"from": "escape-string-regexp@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
},
"form-data": {
"version": "1.0.0-rc4",
"from": "form-data@>=1.0.0-rc3 <1.1.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz"
},
"gauge": {
"version": "1.2.7",
"from": "gauge@>=1.2.5 <1.3.0",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.7.tgz"
},
"fstream": {
"version": "1.0.9",
"from": "fstream@>=1.0.2 <2.0.0",
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.9.tgz"
},
"generate-function": {
"version": "2.0.0",
"from": "generate-function@>=2.0.0 <3.0.0",
@@ -3161,16 +3161,16 @@
"from": "graceful-readlink@>=1.0.0",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz"
},
"har-validator": {
"version": "2.0.6",
"from": "har-validator@>=2.0.6 <2.1.0",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz"
},
"has-ansi": {
"version": "2.0.0",
"from": "has-ansi@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz"
},
"har-validator": {
"version": "2.0.6",
"from": "har-validator@>=2.0.6 <2.1.0",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz"
},
"has-unicode": {
"version": "2.0.0",
"from": "has-unicode@>=2.0.0 <3.0.0",
@@ -3186,16 +3186,16 @@
"from": "hoek@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
},
"http-signature": {
"version": "1.1.1",
"from": "http-signature@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz"
},
"inflight": {
"version": "1.0.4",
"from": "inflight@>=1.0.4 <2.0.0",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz"
},
"http-signature": {
"version": "1.1.1",
"from": "http-signature@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
@@ -3246,16 +3246,16 @@
"from": "json-schema@0.2.2",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.2.tgz"
},
"jsonpointer": {
"version": "2.0.0",
"from": "jsonpointer@2.0.0",
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz"
},
"json-stringify-safe": {
"version": "5.0.1",
"from": "json-stringify-safe@>=5.0.1 <5.1.0",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz"
},
"jsonpointer": {
"version": "2.0.0",
"from": "jsonpointer@2.0.0",
"resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz"
},
"jsprim": {
"version": "1.2.2",
"from": "jsprim@>=1.2.2 <2.0.0",
@@ -3266,16 +3266,16 @@
"from": "lodash._baseslice@>=4.0.0 <4.1.0",
"resolved": "https://registry.npmjs.org/lodash._baseslice/-/lodash._baseslice-4.0.0.tgz"
},
"lodash._basetostring": {
"version": "4.12.0",
"from": "lodash._basetostring@>=4.12.0 <4.13.0",
"resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz"
},
"lodash.pad": {
"version": "4.4.0",
"from": "lodash.pad@>=4.1.0 <5.0.0",
"resolved": "https://registry.npmjs.org/lodash.pad/-/lodash.pad-4.4.0.tgz"
},
"lodash._basetostring": {
"version": "4.12.0",
"from": "lodash._basetostring@>=4.12.0 <4.13.0",
"resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz"
},
"lodash.padend": {
"version": "4.5.0",
"from": "lodash.padend@>=4.1.0 <5.0.0",
@@ -3291,6 +3291,11 @@
"from": "lodash.tostring@>=4.0.0 <5.0.0",
"resolved": "https://registry.npmjs.org/lodash.tostring/-/lodash.tostring-4.1.3.tgz"
},
"mime-db": {
"version": "1.23.0",
"from": "mime-db@>=1.23.0 <1.24.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz"
},
"mime-types": {
"version": "2.1.11",
"from": "mime-types@>=2.1.7 <2.2.0",
@@ -3306,11 +3311,6 @@
"from": "minimist@0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
},
"mime-db": {
"version": "1.23.0",
"from": "mime-db@>=1.23.0 <1.24.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz"
},
"mkdirp": {
"version": "0.5.1",
"from": "mkdirp@>=0.5.0 <0.6.0",
@@ -3321,20 +3321,20 @@
"from": "ms@0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
},
"node-uuid": {
"version": "1.4.7",
"from": "node-uuid@>=1.4.7 <1.5.0",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz"
"nopt": {
"version": "3.0.6",
"from": "nopt@>=3.0.1 <3.1.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz"
},
"npmlog": {
"version": "2.0.3",
"from": "npmlog@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-2.0.3.tgz"
},
"nopt": {
"version": "3.0.6",
"from": "nopt@>=3.0.1 <3.1.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz"
"node-uuid": {
"version": "1.4.7",
"from": "node-uuid@>=1.4.7 <1.5.0",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz"
},
"oauth-sign": {
"version": "0.8.2",
@@ -3371,41 +3371,41 @@
"from": "qs@>=6.1.0 <6.2.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.1.0.tgz"
},
"readable-stream": {
"version": "2.1.2",
"from": "readable-stream@>=2.0.0 <3.0.0||>=1.1.13 <2.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.2.tgz"
},
"request": {
"version": "2.72.0",
"from": "request@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.72.0.tgz"
},
"readable-stream": {
"version": "2.1.2",
"from": "readable-stream@>=2.0.0 <3.0.0||>=1.1.13 <2.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.2.tgz"
},
"rimraf": {
"version": "2.5.2",
"from": "rimraf@>=2.5.0 <2.6.0",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.2.tgz"
},
"sntp": {
"version": "1.0.9",
"from": "sntp@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz"
},
"semver": {
"version": "5.1.0",
"from": "semver@>=5.1.0 <5.2.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.1.0.tgz"
},
"stringstream": {
"version": "0.0.5",
"from": "stringstream@>=0.0.4 <0.1.0",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
"sntp": {
"version": "1.0.9",
"from": "sntp@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"stringstream": {
"version": "0.0.5",
"from": "stringstream@>=0.0.4 <0.1.0",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz"
},
"strip-ansi": {
"version": "3.0.1",
"from": "strip-ansi@>=3.0.0 <4.0.0",
@@ -3514,18 +3514,6 @@
}
}
},
"sshpk": {
"version": "1.8.3",
"from": "sshpk@>=1.7.0 <2.0.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.8.3.tgz",
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"from": "assert-plus@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
}
}
},
"tar-pack": {
"version": "3.1.3",
"from": "tar-pack@>=3.1.0 <3.2.0",
@@ -3537,6 +3525,18 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz"
}
}
},
"sshpk": {
"version": "1.8.3",
"from": "sshpk@>=1.7.0 <2.0.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.8.3.tgz",
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"from": "assert-plus@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
}
}
}
}
},

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "windshaft-cartodb",
"version": "2.53.2",
"version": "2.61.0",
"description": "A map tile server for CartoDB",
"keywords": [
"cartodb"
@@ -20,7 +20,7 @@
],
"dependencies": {
"body-parser": "~1.14.0",
"camshaft": "0.22.2",
"camshaft": "0.33.2",
"cartodb-psql": "~0.6.1",
"cartodb-query-tables": "~0.1.0",
"cartodb-redis": "~0.13.0",
@@ -37,9 +37,9 @@
"request": "~2.62.0",
"step": "~0.0.6",
"step-profiler": "~0.3.0",
"turbo-carto": "0.12.1",
"turbo-carto": "0.14.0",
"underscore": "~1.6.0",
"windshaft": "2.3.0"
"windshaft": "2.4.0"
},
"devDependencies": {
"istanbul": "~0.4.3",

View File

@@ -202,7 +202,7 @@ describe('analysis-layers', function() {
assert.equal(analyses.length, 1, 'Invalid number of analyses in metadata');
var nodes = analyses[0].nodes;
var nodesIds = Object.keys(nodes);
assert.deepEqual(nodesIds, ['2570e105-7b37-40d2-bdf4-1af889598745', 'HEAD']);
assert.deepEqual(nodesIds, ['HEAD', '2570e105-7b37-40d2-bdf4-1af889598745']);
nodesIds.forEach(function(nodeId) {
var node = nodes[nodeId];
assert.ok(node.hasOwnProperty('url'), 'Missing "url" attribute in node');

View File

@@ -204,9 +204,8 @@ describe('analysis-layers error cases', function() {
layergroupResult.errors_with_context[0].message,
'Analysis requires authentication with API key: permission denied.'
);
assert.equal(layergroupResult.errors_with_context[0].context.layer.index, 0);
assert.equal(layergroupResult.errors_with_context[0].context.layer.id, 'HEAD');
assert.equal(layergroupResult.errors_with_context[0].context.layer.type, 'buffer');
assert.equal(layergroupResult.errors_with_context[0].analysis.id, 'HEAD');
assert.equal(layergroupResult.errors_with_context[0].analysis.type, 'buffer');
testClient.drain(done);
});
@@ -258,9 +257,8 @@ describe('analysis-layers error cases', function() {
assert.equal(layergroupResult.errors_with_context[0].type, 'analysis');
assert.equal(layergroupResult.errors_with_context[0].message, 'Missing required param "radius"');
assert.equal(layergroupResult.errors_with_context[0].context.layer.index, 0);
assert.equal(layergroupResult.errors_with_context[0].context.layer.id, 'HEAD');
assert.equal(layergroupResult.errors_with_context[0].context.layer.type, 'buffer');
assert.equal(layergroupResult.errors_with_context[0].analysis.id, 'HEAD');
assert.equal(layergroupResult.errors_with_context[0].analysis.type, 'buffer');
testClient.drain(done);
});

View File

@@ -141,7 +141,7 @@ describe('named-maps analysis', function() {
assert.equal(analyses.length, 1, 'Invalid number of analyses in metadata');
var nodes = analyses[0].nodes;
var nodesIds = Object.keys(nodes);
assert.deepEqual(nodesIds, ['2570e105-7b37-40d2-bdf4-1af889598745', 'HEAD']);
assert.deepEqual(nodesIds, ['HEAD', '2570e105-7b37-40d2-bdf4-1af889598745']);
nodesIds.forEach(function(nodeId) {
var node = nodes[nodeId];
assert.ok(node.hasOwnProperty('url'), 'Missing "url" attribute in node');

View File

@@ -0,0 +1,115 @@
require('../../support/test_helper');
var assert = require('../../support/assert');
var TestClient = require('../../support/test-client');
describe('analysis-layers regressions', function() {
it('should return a complete list of nodes from analysis', function(done) {
var mapConfig = {
"version": "1.5.0",
"layers": [
{
"type": "cartodb",
"options": {
"cartocss": TestClient.CARTOCSS.POINTS,
"cartocss_version": "2.1.1",
"interactivity": [],
"source": {
"id": "a4"
}
}
},
{
"type": "cartodb",
"options": {
"cartocss": TestClient.CARTOCSS.POINTS,
"cartocss_version": "2.1.0",
"interactivity": [],
"source": {
"id": "b1"
}
}
}
],
"dataviews": {
"74493a30-4679-4b72-a60c-b6f808b57c98": {
"type": "histogram",
"source": {
"id": "b0"
},
"options": {
"column": "customer_value",
"bins": 10
}
}
},
"analyses": [
{
"id": "a4",
"type": "point-in-polygon",
"params": {
"polygons_source": {
"id": "a3",
"type": "buffer",
"params": {
"source": {
"id": "a2",
"type": "centroid",
"params": {
"source": {
"id": "b1",
"type": "kmeans",
"params": {
"source": {
"id": "b0",
"type": "source",
"params": {
"query": "SELECT * FROM populated_places_simple_reduced"
}
},
"clusters": 5
}
},
"category_column": "cluster_no"
}
},
"radius": 200000
}
},
"points_source": {
"id": "customer_home_locations",
"type": "source",
"params": {
"query": "SELECT * FROM populated_places_simple_reduced"
}
}
}
}
]
};
var testClient = new TestClient(mapConfig, 1234);
testClient.getLayergroup(function(err, layergroupResult) {
assert.ok(!err, err);
assert.ok(layergroupResult);
assert.ok(layergroupResult.metadata);
var analyses = layergroupResult.metadata.analyses;
assert.ok(analyses);
assert.equal(analyses.length, 1);
var expectedIds = ['customer_home_locations', 'b0', 'b1', 'a2', 'a3', 'a4'];
expectedIds.forEach(function(expectedId) {
assert.ok(
analyses[0].nodes.hasOwnProperty(expectedId),
'Missing "' + expectedId + '" from node list.'
);
});
assert.equal(Object.keys(analyses[0].nodes).length, expectedIds.length, Object.keys(analyses[0].nodes));
testClient.drain(done);
});
});
});

View File

@@ -234,7 +234,7 @@ describe('attributes', function() {
'/**/ typeof test === \'function\' && ' +
'test({"errors":["Layer 0 has no exposed attributes"],' +
'"errors_with_context":[{' +
'"type":"unknown","message":"Layer 0 has no exposed attributes","context":"unknown"' +
'"type":"unknown","message":"Layer 0 has no exposed attributes"' +
'}]});'
);
return null;

View File

@@ -61,7 +61,7 @@ describe('multilayer error cases', function() {
'/**/ typeof test === \'function\' && ' +
'test({"errors":["Missing layers array from layergroup config"],' +
'"errors_with_context":[{"type":"unknown",' +
'"message":"Missing layers array from layergroup config","context":"unknown"}]});'
'"message":"Missing layers array from layergroup config"}]});'
);
done();
});

View File

@@ -56,7 +56,7 @@ describe('turbo-carto error cases', function() {
assert.ok(layergroup.hasOwnProperty('errors'));
assert.equal(layergroup.errors.length, 1);
assert.ok(layergroup.errors[0].match(/^turbo-carto/));
assert.ok(layergroup.errors[0].match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors[0].match(/invalid\sramp\slength/i));
done();
@@ -70,7 +70,7 @@ describe('turbo-carto error cases', function() {
assert.ok(layergroup.hasOwnProperty('errors'));
assert.equal(layergroup.errors.length, 1);
assert.ok(layergroup.errors[0].match(/^turbo-carto/));
assert.ok(layergroup.errors[0].match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors[0].match(/unable\sto\scompute\sramp/i));
assert.ok(layergroup.errors[0].match(/wadus_column/));
@@ -85,7 +85,7 @@ describe('turbo-carto error cases', function() {
assert.ok(layergroup.hasOwnProperty('errors'));
assert.equal(layergroup.errors.length, 1);
assert.ok(layergroup.errors[0].match(/^turbo-carto/));
assert.ok(layergroup.errors[0].match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors[0].match(/unable\sto\scompute\sramp/i));
assert.ok(layergroup.errors[0].match(/invalid\smethod\s\"wadusmethod\"/i));
@@ -100,7 +100,7 @@ describe('turbo-carto error cases', function() {
assert.ok(layergroup.hasOwnProperty('errors'));
assert.equal(layergroup.errors.length, 1);
assert.ok(!layergroup.errors[0].match(/^turbo-carto/));
assert.ok(!layergroup.errors[0].match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors[0].match(/invalid\scode/i));
done();
@@ -114,16 +114,18 @@ describe('turbo-carto error cases', function() {
assert.ok(layergroup.hasOwnProperty('errors'));
assert.equal(layergroup.errors_with_context.length, 1);
assert.equal(layergroup.errors_with_context[0].type, 'turbo-carto');
assert.ok(layergroup.errors_with_context[0].message.match(/^turbo-carto/));
assert.equal(layergroup.errors_with_context[0].type, 'layer');
assert.equal(layergroup.errors_with_context[0].subtype, 'turbo-carto');
assert.ok(layergroup.errors_with_context[0].message.match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors_with_context[0].message.match(/unable\sto\scompute\sramp/i));
assert.ok(layergroup.errors_with_context[0].message.match(/wadus_column/));
assert.equal(layergroup.errors_with_context[0].context.layer.index, 0);
assert.equal(layergroup.errors_with_context[0].context.layer.type, 'mapnik');
assert.equal(layergroup.errors_with_context[0].layer.id, 'layer0');
assert.equal(layergroup.errors_with_context[0].layer.index, 0);
assert.equal(layergroup.errors_with_context[0].layer.type, 'mapnik');
assert.equal(layergroup.errors_with_context[0].context.selector, '#populated_places_simple_reduced');
assert.deepEqual(layergroup.errors_with_context[0].context.source, {
assert.equal(layergroup.errors_with_context[0].layer.context.selector, '#populated_places_simple_reduced');
assert.deepEqual(layergroup.errors_with_context[0].layer.context.source, {
start: {
line: 10,
column: 3
@@ -136,4 +138,53 @@ describe('turbo-carto error cases', function() {
done();
});
});
it('should return multiple errors', function(done) {
var multipleErrorsMapConfig = {
"version": "1.4.0",
"layers": [
{
"type": 'mapnik',
"options": {
"cartocss_version": '2.3.0',
"sql": 'SELECT * FROM populated_places_simple_reduced',
"cartocss": createCartocss(null, 'ramp([wadus_column], (red, green, blue))')
}
},
{
"type": 'mapnik',
"options": {
"cartocss_version": '2.3.0',
"sql": 'SELECT * FROM populated_places_simple_reduced',
"cartocss": createCartocss('ramp([invalid_column], (red, green, blue))')
}
}
]
};
this.testClient = new TestClient(multipleErrorsMapConfig);
this.testClient.getLayergroup(ERROR_RESPONSE, function(err, layergroup) {
assert.ok(!err, err);
assert.ok(layergroup.hasOwnProperty('errors'));
assert.equal(layergroup.errors_with_context.length, 2);
assert.equal(layergroup.errors_with_context[0].type, 'layer');
assert.equal(layergroup.errors_with_context[0].subtype, 'turbo-carto');
assert.ok(layergroup.errors_with_context[0].message.match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors_with_context[0].message.match(/unable\sto\scompute\sramp/i));
assert.ok(layergroup.errors_with_context[0].message.match(/wadus_column/));
assert.equal(layergroup.errors_with_context[0].layer.id, 'layer0');
assert.equal(layergroup.errors_with_context[1].type, 'layer');
assert.equal(layergroup.errors_with_context[1].subtype, 'turbo-carto');
assert.ok(layergroup.errors_with_context[1].message.match(/^Failed\sto\sprocess/));
assert.ok(layergroup.errors_with_context[1].message.match(/unable\sto\scompute\sramp/i));
assert.ok(layergroup.errors_with_context[1].message.match(/invalid_column/));
assert.equal(layergroup.errors_with_context[1].layer.id, 'layer1');
done();
});
});
});

View File

@@ -87,7 +87,7 @@ describe('turbo-carto regressions', function() {
var turboCartoError = layergroup.errors_with_context[0];
assert.ok(turboCartoError);
assert.equal(turboCartoError.type, 'turbo-carto');
assert.equal(turboCartoError.type, 'layer');
assert.ok(turboCartoError.message.match(/permission\sdenied\sfor\srelation\stest_table_private_1/));
done();
@@ -268,33 +268,21 @@ describe('turbo-carto regressions', function() {
};
}
it('should work for numeric ramps', function(done) {
var methods = ['quantiles', 'equal', 'jenks', 'headtails', 'category'];
var makerFillRule = 'ramp([pop_max], (#E5F5F9,#99D8C9,#2CA25F), jenks)';
methods.forEach(function(method) {
it('should work for "' + method+ '" method', function(done) {
var makerFillRule = 'ramp([pop_max], (#E5F5F9,#99D8C9,#2CA25F), ' + method + ')';
this.testClient = new TestClient(emptyResultMapConfig(makerFillRule), 1234);
this.testClient.getLayergroup(function(err, layergroup) {
assert.ok(!err, err);
this.testClient = new TestClient(emptyResultMapConfig(makerFillRule), 1234);
this.testClient.getLayergroup(function(err, layergroup) {
assert.ok(!err, err);
assert.ok(layergroup.hasOwnProperty('layergroupid'));
assert.ok(!layergroup.hasOwnProperty('errors'));
assert.ok(layergroup.hasOwnProperty('layergroupid'));
assert.ok(!layergroup.hasOwnProperty('errors'));
done();
});
});
it('should work for category ramps', function(done) {
var makerFillRule = 'ramp([adm0name], (#E5F5F9,#99D8C9,#2CA25F), category)';
this.testClient = new TestClient(emptyResultMapConfig(makerFillRule), 1234);
this.testClient.getLayergroup(function(err, layergroup) {
assert.ok(!err, err);
assert.ok(layergroup.hasOwnProperty('layergroupid'));
assert.ok(!layergroup.hasOwnProperty('errors'));
done();
done();
});
});
});
});

View File

@@ -75,8 +75,8 @@ if test x"$PREPARE_PGSQL" = xyes; then
dropdb "${TEST_DB}"
createdb -Ttemplate_postgis -EUTF8 "${TEST_DB}" || die "Could not create test database"
LOCAL_SQL_SCRIPTS='windshaft.test gadm4 ported/populated_places_simple_reduced'
REMOTE_SQL_SCRIPTS='CDB_QueryStatements CDB_QueryTables CDB_CartodbfyTable CDB_TableMetadata CDB_ForeignTable CDB_UserTables CDB_ColumnNames CDB_AnalysisCatalog CDB_ZoomFromScale CDB_OverviewsSupport CDB_Overviews CDB_QuantileBins CDB_JenksBins CDB_HeadsTailsBins CDB_EqualIntervalBins CDB_Hexagon CDB_XYZ'
LOCAL_SQL_SCRIPTS='analysis_catalog windshaft.test gadm4 ported/populated_places_simple_reduced'
REMOTE_SQL_SCRIPTS='CDB_QueryStatements CDB_QueryTables CDB_CartodbfyTable CDB_TableMetadata CDB_ForeignTable CDB_UserTables CDB_ColumnNames CDB_ZoomFromScale CDB_OverviewsSupport CDB_Overviews CDB_QuantileBins CDB_JenksBins CDB_HeadsTailsBins CDB_EqualIntervalBins CDB_Hexagon CDB_XYZ'
CURL_ARGS=""
for i in ${REMOTE_SQL_SCRIPTS}

View File

@@ -0,0 +1,30 @@
-- Table to register analysis nodes from https://github.com/cartodb/camshaft
CREATE TABLE IF NOT EXISTS
cartodb.cdb_analysis_catalog (
-- useful for multi account deployments
username text,
-- md5 hex hash
node_id char(40) CONSTRAINT cdb_analysis_catalog_pkey PRIMARY KEY,
-- being json allows to do queries like analysis_def->>'type' = 'buffer'
analysis_def json NOT NULL,
-- can reference other nodes in this very same table, allowing recursive queries
input_nodes char(40) ARRAY NOT NULL DEFAULT '{}',
status TEXT NOT NULL DEFAULT 'pending',
CONSTRAINT valid_status CHECK (
status IN ( 'pending', 'waiting', 'running', 'canceled', 'failed', 'ready' )
),
created_at timestamp with time zone NOT NULL DEFAULT now(),
-- should be updated when some operation was performed in the node
-- and anything associated to it might have changed
updated_at timestamp with time zone DEFAULT NULL,
-- should register last time the node was used
used_at timestamp with time zone NOT NULL DEFAULT now(),
-- should register the number of times the node was used
hits NUMERIC DEFAULT 0,
-- should register what was the last node using current node
last_used_from char(40),
-- last job modifying the node
last_modified_by uuid,
-- store error message for failures
last_error_message text
);

View File

@@ -633,3 +633,18 @@ GRANT SELECT ON TABLE analysis_rent_listings TO :PUBLICUSER;
--
GRANT SELECT, UPDATE, INSERT, DELETE ON cdb_analysis_catalog TO :TESTUSER;
create schema cdb_crankshaft;
GRANT USAGE ON SCHEMA cdb_crankshaft TO :TESTUSER;
CREATE TYPE kmeans_type as (cartodb_id numeric, cluster_no numeric);
CREATE OR REPLACE FUNCTION cdb_crankshaft.CDB_KMeans(query text, no_clusters integer,no_init integer default 20)
RETURNS setof kmeans_type as $$
DECLARE r kmeans_type;
BEGIN
FOR r IN EXECUTE format('select cartodb_id, ceil(random() * 10) AS cluster_no from (%s) _cdb_query', query) loop
RETURN NEXT r;
END LOOP;
RETURN;
END;
$$ LANGUAGE plpgsql;
GRANT ALL ON FUNCTION cdb_crankshaft.CDB_KMeans(text, integer, integer) TO :TESTUSER;

View File

@@ -33,6 +33,39 @@ module.exports.RESPONSE = {
}
};
module.exports.CARTOCSS = {
POINTS: [
'#layer{',
' marker-placement: point;',
' marker-allow-overlap: true;',
' marker-line-opacity: 0.2;',
' marker-line-width: 0.5;',
' marker-opacity: 1;',
' marker-width: 5;',
' marker-fill: red;',
'}'
].join('\n'),
LINES: [
'#lines {',
' line-color: black;',
' line-width: 1;',
' line-opacity: 1;',
'}'
].join('\n'),
POLYGONS: [
'#layer {',
' polygon-fill: red;',
' polygon-opacity: 0.6;',
' polygon-opacity: 0.7;',
' line-color: #FFF;',
' line-width: 0.5;',
' line-opacity: 1;',
'}'
].join('\n')
};
TestClient.prototype.getWidget = function(widgetName, params, callback) {
var self = this;