Compare commits

..

3746 Commits

Author SHA1 Message Date
Álvaro
c792421687 undefined might come as a string (#1196)
so a hack to check and cast it to a real undefined

Co-authored-by: Álvaro Manera <amanera@cartodb.com>
2021-01-15 10:44:05 +01:00
Álvaro
15135b475c add missing env vars (#1195)
* add missing env vars

* add missing space

Co-authored-by: Álvaro Manera <amanera@cartodb.com>
Co-authored-by: alberhander <albertoh@carto.com>
2021-01-14 10:08:25 +01:00
Álvaro Manera
fd9f935676 submodule bump 2020-12-23 07:37:54 +01:00
Álvaro Manera
71f5886a4d 🤬 yaml 2020-12-21 13:21:44 +01:00
Álvaro Manera
bc8c9f973c yaml typo 2020-12-21 13:19:52 +01:00
Álvaro Manera
ec40614f4b configure docker before push 2020-12-21 13:14:36 +01:00
Álvaro
5ed1a3a2d1 Merge pull request #1194 from CartoDB/clean
Use Github actions for builds
2020-12-21 09:06:52 +01:00
Álvaro Manera
0aa5f394e2 update submodule 2020-12-18 16:03:31 +01:00
Álvaro Manera
2e1a3c7fb1 small fixes 2020-12-18 15:22:26 +01:00
Álvaro Manera
27eb00223d minor PR comments 2020-12-18 07:27:59 +01:00
Álvaro Manera
8d46780006 fix master build 2020-12-17 07:22:31 +01:00
Álvaro Manera
6ffd2c090e fix build 2020-12-17 07:15:57 +01:00
Álvaro Manera
3995787c02 use token to pull repos 2020-12-17 07:07:09 +01:00
Álvaro Manera
ddb1b0c0d8 udpate paths and pull submodule 2020-12-16 16:47:19 +01:00
Álvaro Manera
a03d268260 add submodule 2020-12-16 16:40:41 +01:00
Álvaro
5c491a25cf Use env vars and fix tests 2020-12-16 16:32:32 +01:00
Shylpx
92be27e700 Merge pull request #1192 from CartoDB/feature/ch89482/mr-jeff-if-a-column-name-has-an-uppercase
[ch89482] Update 'camshaft' to version 0.67.2
2020-11-23 10:26:20 +00:00
cgonzalez
6b61f5e168 Update 'camshaft' to version 0.67.2 2020-11-18 12:37:38 +00:00
Daniel G. Aubert
d79f1b41d0 Merge pull request #1190 from CartoDB/feature/ch101625/node-windshaft-exiting-because-of-typeerror
Fix logger error serializer when the exception stack is not set
2020-09-09 14:07:23 +02:00
Jorge Tarrero
e039204638 Fix linter 2020-09-09 11:43:33 +02:00
Jorge Tarrero
dc1becd15c Fix logger error serializer when the exception stack is not set 2020-09-09 11:29:32 +02:00
Daniel G. Aubert
a121fd75ab Merge pull request #1189 from CartoDB/fix-kibana-index-bis
Update camshaft to version 0.67.1
2020-08-26 11:50:50 +02:00
Daniel García Aubert
f85417a886 Update NEWS 2020-08-26 11:39:34 +02:00
Daniel García Aubert
8ad72ff2ce Update camshaft to version 0.67.1 2020-08-26 11:36:38 +02:00
Daniel García Aubert
4dd6bc466a Use development version of camshaft 2020-08-26 11:06:26 +02:00
Daniel García Aubert
c119c92de6 Use development version of camshaft 2020-08-26 10:50:16 +02:00
Daniel García Aubert
a3f7acb213 Use development version of camshaft 2020-08-26 10:41:34 +02:00
Daniel García Aubert
0f14ed55db Use development version of camshaft 2020-08-26 09:35:00 +02:00
Rafa de la Torre
528395103b Merge pull request #1186 from CartoDB/feature/ch94770/node-minimal-doc-in-the-repos-about-how-to
[Node] Minimal doc in the repos about how to add new log traces
2020-08-04 09:20:45 +02:00
Rafa de la Torre
288cd9584f Markdown about how to write log traces 2020-08-03 16:31:00 +02:00
Alberto Asuero
cf82e1954e Merge pull request #1185 from CartoDB/alasarr/gitignore
Adding docker ressources to .gitignore
2020-07-29 21:43:13 +02:00
Alberto Asuero
3b00cffc3b New line at .gitignore 2020-07-28 08:58:33 +00:00
Alberto Asuero
95bf39cada Adding docker ressources to .gitignore 2020-07-28 08:56:38 +00:00
Daniel G. Aubert
f9ad3c8acf Merge pull request #1184 from CartoDB/feature/ch91877/remove-log-aggregation-in-metro
Logger: rename key 'msg' => 'event_message'
2020-07-23 14:12:17 +02:00
Daniel García Aubert
28f70f6877 Logger: rename key 'msg' => 'event_message' 2020-07-23 14:01:34 +02:00
Daniel G. Aubert
d5c5d07507 Merge pull request #1183 from CartoDB/feature/ch91877/remove-log-aggregation-in-metro
Metro: stop aggregating logs per request id
2020-07-22 16:00:41 +02:00
Daniel García Aubert
b646f71394 Don't miss the header 2020-07-22 13:35:43 +02:00
Daniel García Aubert
38fe2169aa Update camshaft to version 0.67.0 2020-07-22 13:03:51 +02:00
Daniel García Aubert
a749d4fb43 Typo 2020-07-22 11:40:45 +02:00
Daniel García Aubert
b9198b59a1 Logger: rename 'error' => 'exception' to avoid name clashing in E/S 2020-07-21 17:53:46 +02:00
Daniel García Aubert
3102d895f2 Update camshaft devel version 2020-07-21 17:15:50 +02:00
Daniel García Aubert
b60a69e7d2 Logger: rename level => levelname to avoid name collision 2020-07-21 17:09:19 +02:00
Daniel García Aubert
3937b8c271 Adapt JSON output to the standard structure 2020-07-21 16:36:23 +02:00
Daniel García Aubert
b32a073ac3 Metro: stop aggregating log per request id, use new config.json file 2020-07-20 19:33:33 +02:00
Daniel García Aubert
afd4ad500f Lint 2020-07-01 10:53:04 +02:00
Daniel G. Aubert
cb17bba3f5 Merge pull request #1181 from CartoDB/feature/ch88712/node-windshaft-metro-service-is-not-started
Fix: TypeError: Cannot read property 'level' of undefined
2020-07-01 08:58:26 +02:00
Daniel García Aubert
5b7341c0e9 Fix: TypeError: Cannot read property 'level' of undefined
Feature: dump unfinished log into a file while exiting
2020-06-29 21:01:48 +02:00
Daniel G. Aubert
d65565c091 Merge pull request #1170 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino
Replace log4js logger by pino
2020-06-23 11:56:03 +02:00
Daniel García Aubert
360b98254b Upgrade camshaft to version 0.66.0 2020-06-22 17:01:29 +02:00
Daniel García Aubert
43a603922d Update NEWS 2020-06-22 12:24:06 +02:00
Daniel García Aubert
74116523b4 Merge branch 'master' into dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino 2020-06-22 12:12:45 +02:00
Daniel García Aubert
6cddec562a Profiler don't log times if there is no one task done at least 2020-06-19 11:42:46 +02:00
Daniel García Aubert
22086ba914 Count requests even when the info is not complete 2020-06-19 10:18:06 +02:00
Daniel García Aubert
a68618c336 Prepare init log to be kibana friendly 2020-06-12 10:12:32 +02:00
Daniel García Aubert
578f543c01 log user 2020-06-11 18:21:13 +02:00
Daniel García Aubert
49735308de Do not rename level and error fields 2020-06-11 18:15:44 +02:00
Daniel García Aubert
2444b4c008 rename error => errors to avoid type clashing in ES 2020-06-11 13:04:19 +02:00
Daniel García Aubert
bf250e592a rename level => levelname to avoid type clashing in ES 2020-06-11 12:30:15 +02:00
Daniel García Aubert
f6c8796c8a Do not duplicate timer 2020-06-11 10:12:27 +02:00
Daniel G. Aubert
649f8d701e Merge pull request #1173 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis
Logger improvements
2020-06-11 09:39:07 +02:00
Daniel G. Aubert
568e428a58 Merge pull request #1174 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis-bis
Create log-collector utilility
2020-06-11 09:38:34 +02:00
Daniel G. Aubert
ff00fed43e Merge pull request #1175 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis-bis-bis
Tags Middleware
2020-06-11 09:38:14 +02:00
Daniel G. Aubert
561bc8aef0 Merge pull request #1177 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis-bis-bis-bis
Introducing @carto/metro the CARTO's logs and metrics transport.
2020-06-11 09:37:58 +02:00
Daniel García Aubert
e49ecda321 Don't create a new metric for each request, use the same label to send to statsd 2020-06-10 17:21:35 +02:00
Daniel García Aubert
18525a60cd Use 9145 as default port for metics 2020-06-09 16:35:08 +02:00
Daniel G. Aubert
b8d3971c8a Merge pull request #1178 from CartoDB/fix-layergroup-structure
Layergroup Id should have cache buster defined always
2020-06-09 15:02:28 +02:00
Daniel García Aubert
23839f5b4a Update NEWS 2020-06-09 15:00:53 +02:00
Daniel García Aubert
f235dcdeda Add test 2020-06-09 13:05:39 +02:00
Daniel García Aubert
9c21194c68 Set cache buster equal to 0 when there is no affected tables in the mapconfig 2020-06-09 12:21:47 +02:00
Daniel García Aubert
7acbfc1e9b Typos 2020-06-09 10:00:54 +02:00
Daniel García Aubert
6f9580bae2 Allow the metro to exit if this is the only active server in the event loop system 2020-06-09 09:52:56 +02:00
Daniel García Aubert
3583e064be User native http server 2020-06-09 09:40:24 +02:00
Daniel García Aubert
9e14185990 Rename 2020-06-09 09:30:11 +02:00
Daniel García Aubert
a5c83edef6 Introducing @carto/metro, the carto logs and metrics transport. 2020-06-08 20:16:00 +02:00
Daniel García Aubert
04d0f2e530 Merge branch 'dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis-bis' into dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis-bis-bis 2020-06-08 19:31:18 +02:00
Daniel García Aubert
e206a1bca3 Check whether the log is a pino's log and skip them when they aren't 2020-06-08 16:34:08 +02:00
Daniel García Aubert
b115bca07e Be able to tag requests with labels as easier way to provide business metrics 2020-06-08 16:29:22 +02:00
Daniel García Aubert
07b9decb03 Add log-collector utlity, it will be moved to its onw repository. Attaching it here fro development purposes. Try it with the following command LOG_LEVEL=info npm t | node ./log-collector.js 2020-06-05 20:12:20 +02:00
Daniel García Aubert
02c8e28494 Finalize request's log 2020-06-05 20:08:40 +02:00
Daniel García Aubert
d28744a5e3 Be able to pass the logger to the analysis creation (camshaft) while instantiating a named map with analysis 2020-06-05 20:08:08 +02:00
Daniel García Aubert
a19e9a79b8 Release 9.0.0 2020-06-05 14:10:24 +02:00
Daniel García Aubert
4d7eb555a8 Update carto-package.json 2020-06-05 14:09:40 +02:00
Daniel García Aubert
6f9f53dd03 Be able to reduce the footprint in the final log file depending on the environment 2020-06-04 20:28:06 +02:00
Daniel García Aubert
63bc8f75b9 Typo 2020-06-04 18:43:21 +02:00
Daniel García Aubert
adeffd2018 Centralize common headers, this will help up to move biz metrics out of the process 2020-06-04 17:45:15 +02:00
Daniel G. Aubert
b2da00900f Merge pull request #1171 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis
Do not bind logger to global object
2020-06-04 12:14:21 +02:00
Daniel G. Aubert
0c6d5a1e18 Merge pull request #1172 from CartoDB/dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino-bis-bis
Stop using profiler wrongly
2020-06-04 12:13:43 +02:00
Daniel García Aubert
6945cfc93c Add TODO 2020-06-04 12:10:15 +02:00
Daniel García Aubert
7b53b7c30a Stop using profiling wrongly. Now it only saves custom events from backends (tile, map, attributes, etc..) and calculates the response time. Besides, removed tags to know whether overviews are being used. 2020-06-03 19:51:56 +02:00
Daniel García Aubert
d073f7e3dd typo 2020-06-03 17:34:30 +02:00
Daniel García Aubert
210f5b01ec Make sure all errors use the serializer set for the logger 2020-06-03 17:32:16 +02:00
Daniel García Aubert
1dda183a31 typo 2020-06-03 16:19:42 +02:00
Daniel García Aubert
0eadfe6ee9 Simpligy error middleware 2020-06-03 15:52:24 +02:00
Daniel García Aubert
c37e3f173d Handle error properly in user middleware, it will logged in error middleware 2020-06-03 15:39:02 +02:00
Daniel García Aubert
107a97aa9e Honor @oleurud's comment 2020-06-03 15:11:08 +02:00
Daniel García Aubert
219d2c9044 Shortcuts for serializers 2020-06-03 15:10:31 +02:00
Daniel García Aubert
1e89821d97 Use standard serializers for error, request, and response 2020-06-03 14:28:35 +02:00
Daniel García Aubert
29c6505252 Do not set header 'x-tiler-profiler' and log it instead 2020-06-02 17:09:06 +02:00
Daniel García Aubert
7d8d05b865 Log errors and do not send 'X-Tiler-Errors' header 2020-06-02 16:15:01 +02:00
Daniel García Aubert
afeb91dc86 Bring back logger for windshaft 2020-06-02 13:20:57 +02:00
Daniel García Aubert
b7b3392bdd Be able to set log level from env variable LOG_LEVEL 2020-06-02 13:16:26 +02:00
Daniel García Aubert
b60116410a Use req/res logger instead of the one bound to global object 2020-06-02 12:31:18 +02:00
Daniel García Aubert
ffe19827fd Rename factory and don't use the keyword 'new' to create server while testing 2020-06-02 11:57:11 +02:00
Daniel García Aubert
48c28aea0b Do not bind logger to global object, now it's a part of serverOptions 2020-06-02 11:49:54 +02:00
Daniel García Aubert
62d66f2dbc Do not use global logger in middlewares, use the one initialized in res.locals instead 2020-06-02 09:00:45 +02:00
Daniel García Aubert
e644201756 Merge branch 'master' into dgaubert/ch78384/maps-api-replace-log4js-logger-by-pino 2020-06-01 19:23:21 +02:00
Daniel G. Aubert
481a5928c4 Merge pull request #1169 from CartoDB/update-deps
Update deps
2020-06-01 19:21:34 +02:00
Daniel García Aubert
163c546236 Replace log4js by pino as logger:
- Logs to stdout, disabled while testing
- Change log calls signature when needed
- Use development version of camshaft
- Removes unused log cofiguration
- Bind request id to log req/res
- Log req at the begining of the cycle and res at the end
2020-06-01 19:18:15 +02:00
Daniel García Aubert
656bc9344b Update deps 2020-06-01 13:50:09 +02:00
Daniel García Aubert
b79a8587fa Update deps to fix some security vuln 2020-06-01 12:35:31 +02:00
Daniel G. Aubert
17337974a2 Merge pull request #1168 from CartoDB/dgaubert/ch77050/data-in-headers
Avoid custom headers to be undefined
2020-05-29 16:16:19 +02:00
Daniel García Aubert
6bcf477532 Avoid custom headers to be undefined 2020-05-29 16:06:16 +02:00
Daniel G. Aubert
bf7e8a6ec6 Merge pull request #1167 from CartoDB/dgaubert/ch77050/data-in-headers
Add 'Carto-Stat-Tag', 'Carto-User-Id', and 'Carto-Client' headers
2020-05-26 17:14:32 +02:00
Daniel García Aubert
f31e8b43b6 Duplicate 2020-05-26 17:03:53 +02:00
Daniel García Aubert
0090811510 Typo 2020-05-26 16:56:50 +02:00
Daniel García Aubert
b97aeda53c Adapt test-client to handle client query param 2020-05-26 16:52:13 +02:00
Daniel García Aubert
f82232194c Under if 2020-05-26 16:31:53 +02:00
Daniel García Aubert
aff5c9a614 Add test to check the headers exist while instantiating a map 2020-05-26 16:28:44 +02:00
Daniel García Aubert
ddefb1a6ca Add 'Carto-Stat-Tag', 'Carto-User-Id', and 'Carto-Client' headers 2020-05-26 13:15:35 +02:00
Daniel G. Aubert
4d06fee1e2 Merge pull request #1164 from CartoDB/node-12
Support Node.js 12
2020-05-20 15:57:46 +02:00
Daniel García Aubert
8febd81ed2 Merge branch 'master' into node-12 2020-05-20 09:15:05 +02:00
Daniel García Aubert
e575f01bef Upgrade gc-stats to version 1.4.0 2020-05-14 19:32:47 +02:00
Raúl Marín
f25f507945 Merge pull request #1165 from Algunenano/clang9
Force our packages to be used
2020-05-14 18:11:15 +02:00
Raúl Marín
bdbb529ea8 Force clang-9 to be used 2020-05-14 17:52:06 +02:00
Daniel García Aubert
0aac942aa1 Make query idempotent among PG versions 2020-05-14 13:13:32 +02:00
Daniel García Aubert
8cc24bc665 - Drop support for Node.js < 12
- Support Node.js 12
- Upgrade `windshaft` to version `7.0.0`
- Upgrade `camshaft` to version `0.65.3`
- Upgrade `cartodb-redis` to version `3.0.0`
2020-05-14 13:00:23 +02:00
Daniel G. Aubert
478ea66678 Merge pull request #1162 from CartoDB/dgaubert/ch71093/update-maps-api-to-new-event-format
New event format for metrics
2020-05-01 13:34:57 +02:00
Daniel García Aubert
4dfc898587 Don't log when metrics where sent successfully 2020-05-01 13:25:03 +02:00
Daniel García Aubert
05e77b2aed Add test with mapconfig's query against a table to ensure cache buster metrics are sent with the right values. 2020-05-01 11:43:37 +02:00
Daniel García Aubert
24863b6393 Update NEWS 2020-05-01 10:51:33 +02:00
Daniel García Aubert
3cf17c8bab typo 2020-05-01 10:40:56 +02:00
Daniel García Aubert
8c38ecf808 Missing substring 2020-04-30 13:24:41 +02:00
Daniel García Aubert
a196a26ab4 Get templateHash for static tile request and errored named map instantiations 2020-04-30 13:09:12 +02:00
Daniel García Aubert
8d73571f5b Simplify assertions 2020-04-30 12:31:12 +02:00
Daniel García Aubert
d5348dd9d4 Rename fields from headers of metrics 2020-04-29 18:48:10 +02:00
Daniel García Aubert
7e31b956bf Send stat_tag metric when available 2020-04-29 18:25:01 +02:00
Daniel García Aubert
dbc5d65d90 Send template_hash as part of the metrics event 2020-04-29 17:26:33 +02:00
Daniel García Aubert
c91d78fe51 Also export template hash 2020-04-29 16:44:14 +02:00
Daniel García Aubert
798d010776 Ensure "map_id" and "cache_buster" as part of the event 2020-04-29 14:32:08 +02:00
Daniel García Aubert
70f0b6ea50 Avoid to use "pubsub" for the name of modules, middlewares, variables, etc.. 2020-04-29 10:40:45 +02:00
Daniel García Aubert
4e3ef96374 Add test to chek we still send events when errored map static tile 2020-04-29 10:28:10 +02:00
Daniel García Aubert
c88a14bf43 Send metrics for map instantiations (named, anonymous and static) with the new format. 2020-04-28 19:17:00 +02:00
Daniel García Aubert
7f5ed58a79 Add test 2020-04-27 18:40:28 +02:00
Daniel García Aubert
89e349146d Fix tests and stop using sinon as a dev dependency 2020-04-27 18:02:06 +02:00
Daniel García Aubert
c5cb2ea4cb Add FIXME comment 2020-04-27 13:35:19 +02:00
Daniel García Aubert
fe9610abe9 Missing logger argument 2020-04-27 13:35:07 +02:00
Daniel García Aubert
1bbde4f5e3 Let to the caller to choose how to handle the call to a method 2020-04-27 13:27:05 +02:00
Daniel García Aubert
e90c196598 Simplified metrics middleware and backend 2020-04-27 12:46:27 +02:00
Daniel García Aubert
6a2333be64 Topic name's lifetime is longer than pubsub backend, we can keep it as property. 2020-04-27 12:13:54 +02:00
Daniel García Aubert
7d6a64d383 Do not expose functions just to be able to mock them while testing 2020-04-27 11:59:36 +02:00
Daniel García Aubert
42dc2915ea Send pubsub metrics once the response has finished 2020-04-27 11:41:37 +02:00
Daniel García Aubert
3cec6b5a90 Missing callback 2020-04-27 11:06:09 +02:00
Daniel García Aubert
c31e3d6e3f Consistent interface when returning no event for eventa data in metrics 2020-04-27 10:58:37 +02:00
Daniel García Aubert
6e4c8a6639 Follow Node.js callback pattern 2020-04-27 10:23:11 +02:00
Manuel J. Morillo
809c267419 Merge pull request #1161 from CartoDB/fix_parsing_columns_histograms_1160
Fixes 1160: Prevent using cast column as part of __ctx_query
2020-04-23 13:12:32 +02:00
manmorjim
5ac27d1002 Update NEWS 2020-04-10 14:34:02 +02:00
manmorjim
7237fb04a8 Adding test for column date type in numeric histograms 2020-04-10 14:33:38 +02:00
manmorjim
d1696425fd Prevent using cast column from alias __ctx_query
Fixes #1160 by keep the original name of the column and using it if the
column type is date.
2020-04-10 14:14:24 +02:00
Raúl Marín
a614fb1ef6 Merge pull request #1159 from Algunenano/travis_12
Travis: Add pg12
2020-04-09 15:09:07 +02:00
Raúl Marín
aa38dd3b59 Travis: Add pg12 2020-04-09 13:20:51 +02:00
Daniel G. Aubert
2ac050501b Merge pull request #1158 from CartoDB/get-tile-promises
Version  9.0.0
2020-04-05 13:23:18 +02:00
Daniel García Aubert
03abe187ce Update NEWS and prepera next major release version 2020-04-05 13:16:45 +02:00
Daniel García Aubert
a83d0cf7af Update windshaft to released version 6.0.0 2020-04-05 12:59:58 +02:00
Daniel García Aubert
8bb4fbec12 Get the rendererCache's config right and avoid to set the NamedMapCacheReporter's interval to 'undefined' 2020-04-04 18:51:22 +02:00
Daniel García Aubert
a8fb51ba25 - Rename NamedMapProviderReporter by NamedMapProviderCacheReporter
- Extract getOnTileErrorStrategy to a module
- Stop using MapStore from windshaft while testing and create a custom one instead
2020-04-04 17:46:08 +02:00
Daniel García Aubert
24efc37737 Update windshaft development version 2020-04-04 17:42:52 +02:00
Daniel García Aubert
c25678cc28 Remove /version endpoint and bootstrapFonts at process startup (now done in windshaft) 2020-04-04 17:42:26 +02:00
Daniel García Aubert
44970b78a1 TODO 2020-04-04 17:35:09 +02:00
Daniel García Aubert
a3bdbf6202 In tests, stop using mapnik module exposed by windshaft and require it from development dependencies 2020-04-04 17:34:22 +02:00
Daniel García Aubert
f583a4240a Remove jshint comments 2020-04-04 17:29:33 +02:00
Daniel García Aubert
4054c6923f Use new signature for onTileErrorStrategy 2020-03-27 19:38:28 +01:00
Daniel García Aubert
7a1d84a3fb Update windshaft 2020-03-27 16:59:30 +01:00
Daniel García Aubert
58ed7c0093 Lint 2020-03-23 10:07:24 +01:00
Daniel García Aubert
f56e79ed1f Update windshaft 2020-03-23 10:01:54 +01:00
Daniel García Aubert
45c423bbaf Update windshaft 2020-03-21 18:53:32 +01:00
Daniel García Aubert
78f47e5873 Update windshaft and send more metrics 2020-03-21 18:30:38 +01:00
Daniel García Aubert
21d1a56953 Update windshaft and use the new method that reports stats about cached renderers 2020-03-21 14:13:53 +01:00
Daniel García Aubert
69a02bcee0 Fix stat named map providers cache count 2020-03-20 18:50:22 +01:00
Daniel García Aubert
d2c0f553fc Update windshaft to development version 2020-03-18 19:50:35 +01:00
Daniel García Aubert
3967aecfdc Fix test where http-fallback-image renderer was failing quietly 2020-03-18 19:45:31 +01:00
Esther Lozano
7b8cc0a8b8 Add response time to pubsub events (#1155) 2020-03-10 11:40:01 +01:00
Daniel G. Aubert
28c4e89ab5 Merge pull request #1156 from CartoDB/camshaft-0.65.3
Upgrade camshaft to version 0.65.3
2020-03-05 12:14:52 +01:00
Daniel García Aubert
8c42ac9053 Update NEWS and project version 2020-03-05 11:40:46 +01:00
Daniel García Aubert
86987f9e69 Upgade camshaft to version 0.65.3 2020-03-05 11:36:23 +01:00
Simon Martín
33a8267d2c Merge pull request #1154 from CartoDB/add-pubsub-metrics
Add pubsub metrics
2020-02-27 11:14:32 +01:00
Esther Lozano
779a8a8927 Fix linter 2020-02-26 17:44:53 +01:00
Esther Lozano
1888302cee Avoid normalizing empty fields 2020-02-26 17:41:41 +01:00
Esther Lozano
34c446909e Trim fields when normalizing 2020-02-26 14:50:41 +01:00
Esther Lozano
583765a298 Normalize headers values for pubsub 2020-02-26 13:24:46 +01:00
Esther Lozano
4b1f0b5775 Add unit and integration tests for pubsub 2020-02-25 14:14:44 +01:00
Esther Lozano
8f81c810e0 Continue middleware chain after response or error 2020-02-25 14:14:20 +01:00
Esther Lozano
970be73052 Allow extra headers in the requests of test client 2020-02-24 12:30:46 +01:00
Esther Lozano
e85469cc3c Use middleware for all requests 2020-02-20 15:25:53 +01:00
Esther Lozano
4a41ee8f75 Add backend and middleware for pubsub metrics 2020-02-20 11:48:32 +01:00
Esther Lozano
9591a5a2b0 Store userId in res.locals 2020-02-20 11:47:44 +01:00
Javier Goizueta
8f510f401e Release 8.1.1 2020-02-17 18:49:24 +01:00
Javier Goizueta
92678c3dae Merge pull request #1152 from CartoDB/1117-camshaft-update
Upgrade camshaft to 0.65.2
2020-02-17 18:46:14 +01:00
Javier Goizueta
9f2d1f90d0 Update NEWS 2020-02-17 18:36:18 +01:00
Javier Goizueta
23e331610d Upgrade camshaft to 0.65.2 2020-02-17 18:36:05 +01:00
Esther Lozano
59cb6f9c9c Rename headers for metrics 2020-02-17 17:07:26 +01:00
Esther Lozano
98325495ea Allow metrics custom headers in cors 2020-02-13 12:52:20 +01:00
Daniel García Aubert
576518b2c8 Stubs next vesion 2020-01-27 12:56:44 +01:00
Daniel García Aubert
0631bafbbf Release 8.1.0 2020-01-27 12:47:57 +01:00
Daniel García Aubert
d9b6284914 Update carto_postgresql_ext minor dependency version 2020-01-27 12:45:35 +01:00
Daniel García Aubert
111b927033 Minor doc fixes 2019-12-30 12:43:00 +01:00
Daniel G. Aubert
d63337f06f Merge pull request #1150 from CartoDB/new-filters
New dataview filters: circle & polygon
2019-12-20 09:40:09 +01:00
Daniel García Aubert
7012e6a66a Update NEWS 2019-12-20 09:37:27 +01:00
Daniel García Aubert
726e1a2268 Add test to validate parameters 2019-12-16 16:12:57 +01:00
Daniel García Aubert
6e455a1205 Better condition 2019-12-16 12:54:17 +01:00
Daniel García Aubert
da07d550d2 Use ST_DWithin() 2019-12-16 12:30:52 +01:00
Daniel García Aubert
1829a634e9 Add formula dataview test 2019-12-16 09:28:11 +01:00
Daniel García Aubert
95f66b8c4b Transform from 3857 2019-12-13 12:36:13 +01:00
Daniel García Aubert
ea1f43bec7 Fix query to make the proper transformations 2019-12-11 11:02:31 +01:00
Daniel García Aubert
c877d0b964 Implement polygon filter 2019-12-03 10:58:55 +01:00
Daniel García Aubert
caf09ac644 Rename file 2019-12-03 10:02:51 +01:00
Daniel García Aubert
17f151cd5a Implement circle filter for dataviews 2019-12-02 18:36:41 +01:00
Daniel García Aubert
0940158d01 Implemented tests, happy cases 2019-12-02 16:17:55 +01:00
Daniel G. Aubert
e6bbe8351d Merge pull request #1148 from CartoDB/no-makefile
Simplify npm scripts
2019-12-02 15:14:17 +01:00
Raúl Marín
031bae2564 Merge pull request #1149 from Algunenano/find_cartodb
Update camshaft to 0.65.1
2019-12-02 14:54:05 +01:00
Raúl Marín
b8d790caab Update camshaft to 0.65.1 2019-12-02 14:22:41 +01:00
Daniel García Aubert
267557eb90 Simplify npm scripts 2019-12-02 14:15:40 +01:00
Daniel García Aubert
b2af93dfec Remove reference to unexistent file 2019-12-02 14:14:40 +01:00
Raúl Marín
7e81618769 Merge pull request #1147 from Algunenano/find_cartodb
Enforce the usage of cartodb schema
2019-12-02 13:58:33 +01:00
Daniel G. Aubert
eeac5ce998 Merge pull request #1146 from CartoDB/no-makefile
Leftovers from #1145
2019-12-02 13:55:00 +01:00
Raúl Marín
fcf2fd1455 Enforce the usage of cartodb schema 2019-12-02 13:43:21 +01:00
Daniel García Aubert
fb9dce0386 Lint 2019-12-02 12:56:21 +01:00
Daniel García Aubert
4c09a70647 Avoid to overwrite env, just extend it with new env variables 2019-12-02 12:51:16 +01:00
Daniel García Aubert
eee59abfa1 Remove unused bash script 2019-12-02 12:43:59 +01:00
Daniel G. Aubert
c7effbccb4 Merge pull request #1145 from CartoDB/no-makefile
Improve project usability
2019-12-02 12:36:41 +01:00
Daniel García Aubert
2912e4fea6 Update NEWS and Release version 2019-12-02 12:30:19 +01:00
Daniel García Aubert
2d09a214ae Leftovers from other PR 2019-12-02 11:02:35 +01:00
Daniel García Aubert
a88c085278 Update 'how to release' document 2019-12-01 19:03:47 +01:00
Daniel García Aubert
5dcca3e088 Update 'how to release' document 2019-12-01 19:00:27 +01:00
Daniel García Aubert
413a1685aa Set default timeout 2019-12-01 14:20:01 +01:00
Daniel García Aubert
7081a7ec3c Better script organization 2019-12-01 13:04:56 +01:00
Daniel García Aubert
33143ea28e Update doc 2019-12-01 13:04:31 +01:00
Daniel García Aubert
f8c86f3b72 Don't be bombastic 2019-11-29 17:23:27 +01:00
Daniel García Aubert
ae53cc736b Merge branch 'master' into no-makefile 2019-11-29 16:39:44 +01:00
Daniel García Aubert
eca75d1365 Removed unused docker files 2019-11-29 16:33:47 +01:00
Daniel García Aubert
ef201e6fcf Improve docker section in docs 2019-11-29 16:30:48 +01:00
Daniel García Aubert
38a556b7d6 Improve spelling in documentation 2019-11-29 15:55:41 +01:00
Daniel García Aubert
c071746768 npm install 2019-11-29 13:51:09 +01:00
Daniel García Aubert
57512ba48b Format 2019-11-29 13:47:38 +01:00
Daniel García Aubert
dcf765efda Merge pre-install scripts 2019-11-29 13:43:05 +01:00
Daniel García Aubert
525d41e63c Merge pre-install scripts 2019-11-29 13:41:18 +01:00
Daniel García Aubert
7d7ca0de4a Add run perms to pre-install script 2019-11-29 13:32:05 +01:00
Daniel García Aubert
11e5726ea9 Improve coverage section 2019-11-29 13:24:12 +01:00
Daniel García Aubert
d3f0c52474 Add test and coverage sections 2019-11-29 13:19:47 +01:00
Daniel García Aubert
8523f835dc Format 2019-11-29 13:13:31 +01:00
Daniel García Aubert
63ccfac599 Add links 2019-11-29 13:11:19 +01:00
Daniel García Aubert
283baa4a3f remove death link 2019-11-29 13:00:54 +01:00
Daniel García Aubert
c7bd132e2f Add developers center link 2019-11-29 12:58:16 +01:00
Daniel García Aubert
3c92e186d6 Missing optional requirement 2019-11-29 12:51:12 +01:00
Daniel García Aubert
67d8919f8a Typos 2019-11-29 12:48:00 +01:00
Daniel García Aubert
06c0b28d37 Add versioning and license sections 2019-11-29 12:44:31 +01:00
Daniel García Aubert
dfedb45254 Update description and keywords 2019-11-29 12:37:33 +01:00
Daniel García Aubert
b373965510 Improve format contributing section 2019-11-29 12:30:56 +01:00
Daniel García Aubert
52d887f3b4 typos 2019-11-29 12:27:15 +01:00
Daniel García Aubert
a6ca480210 Improve section 2019-11-29 11:27:11 +01:00
Daniel García Aubert
16e80424e0 Typo 2019-11-29 11:23:42 +01:00
Daniel García Aubert
6c72d3adbe Typo 2019-11-29 11:22:32 +01:00
Daniel García Aubert
bbc9c9fb9b Merge documents into README 2019-11-29 11:18:25 +01:00
Daniel García Aubert
42d0c4c040 Remove unused makefile scripts 2019-11-28 19:56:49 +01:00
Daniel García Aubert
8f99886d62 Clean script 2019-11-28 19:46:22 +01:00
Daniel García Aubert
60c01e583f Remove deprecated coverage dep. Use nyc instead 2019-11-28 19:46:02 +01:00
Daniel García Aubert
f21f89f561 Move script to docker folder 2019-11-28 18:52:22 +01:00
Daniel García Aubert
5f900a3b3c Update command 2019-11-28 18:45:05 +01:00
Daniel García Aubert
60db55b122 Missin configuration file in CI 2019-11-28 18:42:04 +01:00
Daniel García Aubert
d9c05a9333 Don't use bash script to run ci test 2019-11-28 18:28:01 +01:00
Daniel García Aubert
ab66ad83fd Exec psql commands in batches 2019-11-28 18:07:44 +01:00
Daniel García Aubert
3498fceb6a Improve npm script hooks 2019-11-28 18:07:25 +01:00
Daniel García Aubert
e841774978 Set node env for test 2019-11-28 17:30:29 +01:00
Daniel García Aubert
f297044203 Exec redis comands in batches 2019-11-28 17:30:06 +01:00
Daniel García Aubert
c7e803a94c missing middleware 2019-11-26 15:46:56 +01:00
Raúl Marín
ac198d5b5a Merge pull request #1143 from CartoDB/quote_columns
Quote columns
2019-11-25 13:55:38 +01:00
Raúl Marín
6eb66de94e Unify stripQuotes 2019-11-25 13:38:42 +01:00
Raúl Marín
f545b4d002 camshaft quote_columns 2019-11-25 13:17:09 +01:00
Daniel García Aubert
eee3e8b63c Draft: added script to setup and tear down tests 2019-11-22 19:47:00 +01:00
Daniel G. Aubert
69afee61e0 Merge pull request #1136 from CartoDB/eslint
Eslint
2019-11-14 16:16:47 +01:00
Daniel García Aubert
724f67d381 Update NEWS 2019-11-14 16:09:38 +01:00
Daniel García Aubert
8d69af4445 Merge branch 'master' into eslint 2019-11-14 14:53:53 +01:00
Daniel G. Aubert
3c301ce742 Merge pull request #1141 from CartoDB/fix-undefinded-layergroupTTL
Fix undefinded layergroup ttl
2019-11-14 14:50:32 +01:00
Daniel García Aubert
f87c432744 Use good defaults 2019-11-14 13:14:31 +01:00
Daniel García Aubert
d446ba9c1b Merge branch 'eslint' of github.com:CartoDB/Windshaft-cartodb into eslint 2019-11-14 12:34:47 +01:00
Daniel García Aubert
dc669f5cd4 Do not use object built-ins 2019-11-14 12:18:13 +01:00
Daniel García Aubert
d4719d5707 camel case 2019-11-14 12:17:26 +01:00
Daniel García Aubert
f9082dad94 Merge branch 'eslint' of github.com:CartoDB/Windshaft-cartodb into eslint 2019-11-14 11:13:04 +01:00
Daniel García Aubert
a8d421c9cc Merge branch 'eslint' of github.com:CartoDB/Windshaft-cartodb into eslint 2019-11-13 20:08:04 +01:00
Daniel García Aubert
7b13c12ab4 Automatically lint fixes 2019-11-13 20:07:41 +01:00
Daniel García Aubert
97f4adbc1a camel case 2019-11-13 20:05:19 +01:00
Daniel García Aubert
602ab44375 camel case 2019-11-13 19:47:29 +01:00
Daniel García Aubert
77e6fb8225 Avoid to pass undefined layergroupTTL 2019-11-13 19:29:41 +01:00
Daniel García Aubert
2c8a030ecb Merge branch 'master' into eslint 2019-11-13 19:00:50 +01:00
Daniel García Aubert
ccd01e6da5 Stubs next version 2019-11-13 13:17:47 +01:00
Daniel García Aubert
df10cfe641 Release 8.0.0 2019-11-13 13:07:00 +01:00
Daniel G. Aubert
09d3e8aabb Merge pull request #1139 from CartoDB/fix/bad-aggregation-method-overview
Validate aggregation method is either sum or count
2019-11-13 10:11:28 +01:00
Esther Lozano
f17411916f Remove unnecessary config in tests 2019-11-12 17:43:03 +01:00
Esther Lozano
75583f67c5 Use last version for map config in tests 2019-11-12 14:54:25 +01:00
Esther Lozano
bb745b0318 Update test/acceptance/dataviews/overviews-test.js
Co-Authored-By: Daniel G. Aubert <danielgarciaaubert@gmail.com>
2019-11-12 14:48:37 +01:00
Raúl Marín
3834aeb73f Merge pull request #1140 from Algunenano/local_password
Fix multiple DB login issues
2019-11-12 13:23:34 +01:00
Raúl Marín
aa09c079f6 Fix multiple DB login issues 2019-11-12 13:15:32 +01:00
Raúl Marín
3c586caba4 Qualify calls to cartodb extension so having it in the search_path isn't necessary 2019-11-12 13:15:32 +01:00
Esther Lozano
b05740048c Update NEWS.md 2019-11-12 12:48:22 +01:00
Esther Lozano
2b5ed21207 Remove only in tests :P 2019-11-12 12:37:24 +01:00
Esther Lozano
acecb88efb Validate aggregation method is either sum or count 2019-11-11 18:14:30 +01:00
Daniel García Aubert
734c373f3d Camel case 2019-11-11 12:26:04 +01:00
Daniel García Aubert
e49cb524a8 Update makefile 2019-11-06 14:02:37 +01:00
Daniel García Aubert
cc24228511 Fix eslint issues 2019-11-06 13:56:59 +01:00
Daniel García Aubert
27106fea57 Avoid regular string contains what looks like a template literal placeholder 2019-11-06 13:29:03 +01:00
Simon Martín
990aaadc16 Merge pull request #1134 from CartoDB/better-redis-logging
Adding a logger to MapStore
2019-10-29 12:10:00 +01:00
Simon Martín
0c572b5947 NEWS 2019-10-29 11:37:16 +01:00
Simon Martín
3e7c294989 linter 2019-10-29 11:32:27 +01:00
Simon Martín
8a02156ac0 fix tests 2019-10-29 10:31:31 +01:00
Simon Martín
c4a75de0d8 windshaft 5.6.4 2019-10-28 18:15:15 +01:00
Simon Martín
db03bcdf8f windshaft logger by config param 2019-10-28 15:41:46 +01:00
Simon Martín
dd5825c770 using a new logger 2019-10-28 11:55:43 +01:00
Daniel García Aubert
8fbe8f9f2a Remove unused vars 2019-10-25 10:58:00 +02:00
Daniel García Aubert
3bc3d19f40 Stop using legacy URL api 2019-10-25 09:38:05 +02:00
Daniel García Aubert
575fe8e350 Remove unnecessary escape usage 2019-10-24 19:18:47 +02:00
Daniel García Aubert
d5218a86f6 Enforce callback error handling 2019-10-24 18:38:37 +02:00
Simon Martín
080f93f6de passing logger to MapStore 2019-10-24 17:34:46 +02:00
Simon Martín
df931d95a3 using github:cartodb/windshaft#better-redis-logging 2019-10-24 17:34:30 +02:00
Daniel García Aubert
d5406d5b50 remove jshint comment 2019-10-22 19:22:38 +02:00
Daniel García Aubert
f7e877ce60 Use template string istead of ES5 string line break 2019-10-22 19:11:32 +02:00
Daniel García Aubert
ad4a1ada45 Do not use string concatenation when using __dirname and __filename 2019-10-22 18:22:33 +02:00
Daniel García Aubert
da0d0d21e3 Remove jshintrc 2019-10-21 23:33:52 +02:00
Daniel García Aubert
7a1d2ca205 Avoid calling Object.prototype methods directly on object instances 2019-10-21 23:33:27 +02:00
Daniel García Aubert
d89e785440 Stop using deprecated Buffer constructor 2019-10-21 20:05:51 +02:00
Daniel García Aubert
2423b5a4c4 Replace assert.deepEqual() by assert.deepStrictEqual() 2019-10-21 19:52:51 +02:00
Daniel García Aubert
1bee877b24 Replace assert.equal() by assert.strictEqual() 2019-10-21 19:41:03 +02:00
Daniel García Aubert
4d70ac0894 Apply automatic eslint fixes 2019-10-21 19:07:24 +02:00
Daniel García Aubert
593d9e40f6 Remove jshint, add eslint and config 2019-10-21 18:50:01 +02:00
Daniel G. Aubert
9fd1a3c663 Merge pull request #1131 from CartoDB/coherent-cache-invalidation
Coherent cache invalidation
2019-10-21 16:41:28 +02:00
Daniel García Aubert
8a781d241c Typo 2019-10-21 16:22:26 +02:00
Daniel García Aubert
be4d610de1 Use released version of cartodb-query-tables 0.7.0 2019-10-21 16:17:54 +02:00
Daniel García Aubert
736d3460d9 Update development branch 2019-10-21 13:46:29 +02:00
Daniel García Aubert
f844d70275 Replace http --> https. I swear, I'm not a spy 2019-10-21 11:32:56 +02:00
Daniel García Aubert
0c9cfefcd0 Please jshint, can you be a regular linter? 2019-10-21 11:13:54 +02:00
Daniel García Aubert
8ed187b0f5 Do not set Last-Modifed to January 1st 1970 when cache buster ins layergroup token is 0. In this case, 0 means we don't know when the resource was updated for the last time. 2019-10-21 11:01:05 +02:00
owayss
e5bada81dc Merge pull request #1132 from CartoDB/default_to_stdout_logging
Default to stdout logging on dev environment
2019-10-17 14:13:28 +02:00
Owayss Kabtoul
655f817033 Default to stdout logging on dev environment 2019-10-17 13:04:10 +02:00
Daniel García Aubert
ebff2ac9f2 Please JSHint 2019-10-15 13:27:40 +02:00
Daniel García Aubert
5a7ffcf499 Be able to synchronize the TTL of cache-control header to expire in a coherent way 2019-10-15 12:48:50 +02:00
Daniel García Aubert
f8e117a7b7 JSHint is not ready for modern javascript 2019-10-15 11:46:44 +02:00
Daniel García Aubert
c4054f0ac9 Use develop branch of query-tables 2019-10-15 10:39:31 +02:00
Daniel García Aubert
f7707141d6 Rename variable 2019-10-08 17:22:24 +02:00
Daniel G. Aubert
c40c42fc10 Merge pull request #1130 from CartoDB/remove-routes-adapter
Remove environment configuration adapter
2019-10-08 16:34:24 +02:00
Daniel García Aubert
6cad976078 Remove environment configuration adapter 2019-10-08 11:02:32 +02:00
Daniel G. Aubert
c82f17e5d2 Merge pull request #1126 from CartoDB/gears
Be able to inject middlewares from configuration
2019-10-07 17:35:01 +02:00
Daniel G. Aubert
1054bde7fd Merge pull request #1127 from CartoDB/folders
Standardize folder structure and filenames
2019-10-07 17:34:27 +02:00
Daniel G. Aubert
9e23b91f3f Merge pull request #1129 from CartoDB/fix-routes-config
Convert from v1 to api in routes config
2019-10-07 17:34:00 +02:00
Daniel García Aubert
ea6e064e42 Convert from v1 to api in routes config 2019-10-07 14:08:59 +02:00
Raúl Marín
cf0858f5b9 Merge pull request #1128 from Algunenano/sec
Tests: Remove unnecessary extra qualification
2019-10-07 14:03:06 +02:00
Raul Marin
69b11a8412 sec 2019-10-07 13:36:18 +02:00
Daniel García Aubert
55aad4254c Remove cartodb folder in unit test 2019-10-07 11:29:07 +02:00
Daniel García Aubert
73e1659378 Add suffix '-test' to every test-suite file 2019-10-07 11:16:48 +02:00
Daniel García Aubert
98f3e8159e Stop using __dirname in requires 2019-10-07 10:55:26 +02:00
Daniel García Aubert
e8cff194fc Rename template_maps -> template-maps 2019-10-07 10:50:14 +02:00
Daniel García Aubert
f1de1b3b91 Rename test files: stop using underscores, use hyphens instead 2019-10-07 10:44:45 +02:00
Daniel García Aubert
a134ab3012 Rename server_options -> server-options 2019-10-07 10:10:51 +02:00
Daniel García Aubert
5a84d7233b Rename table_name_parser -> table-name-parser 2019-10-07 10:07:25 +02:00
Daniel García Aubert
8fe0112568 Rename overviews_query_rewriter -> overviews-query-rewriter 2019-10-07 10:06:01 +02:00
Daniel García Aubert
3acaac5403 Rename icu_data_env_setter -> icu-data-env-setter 2019-10-07 10:04:39 +02:00
Daniel García Aubert
7dbac5a565 Rename profiler_proxy -> profiler-proxy 2019-10-07 10:01:18 +02:00
Daniel García Aubert
8fb4f4063f Rename health_check -> health-check 2019-10-07 09:59:54 +02:00
Daniel García Aubert
808718fb26 Rename cdb_request -> cdb-request 2019-10-07 09:58:21 +02:00
Daniel García Aubert
6dc8de315a Rename surrogate_keys_cache -> surrogate-keys-cache 2019-10-07 09:56:20 +02:00
Daniel García Aubert
afb9b08925 Rename surrogate_keys_cache -> surrogate-keys-cache 2019-10-07 09:55:55 +02:00
Daniel García Aubert
2bed034e64 Rename named_map_provider_cache -> named-map-provider-cache 2019-10-07 09:54:54 +02:00
Daniel García Aubert
2328bb6261 Rename layergroup_affected_tables -> layergroup-affected-tables 2019-10-07 09:53:06 +02:00
Daniel García Aubert
06357fa3f9 Rename named_maps_entry -> named-maps-entry 2019-10-07 09:51:51 +02:00
Daniel García Aubert
83f58288f9 Rename varnish_http -> varnish-http 2019-10-07 09:47:42 +02:00
Daniel García Aubert
b1d5f0f9e8 Rename pg_query_runner -> pg-query-runner 2019-10-07 09:45:46 +02:00
Daniel García Aubert
7142e4db37 Rename pg_connection -> pg-connection 2019-10-07 09:43:40 +02:00
Daniel García Aubert
281a079a62 Simplify folder structure 2019-10-07 09:40:50 +02:00
Daniel García Aubert
0d638e6bad Fix command example 2019-10-06 19:12:11 +02:00
Daniel García Aubert
43a63feaca Keep the backwards compatibility for routing configuration 2019-10-06 18:58:21 +02:00
Daniel García Aubert
4aa6ffe28c Add tests to check custom middlewares behavior 2019-10-04 17:54:32 +02:00
Daniel García Aubert
2ce688ee2a Missed to apply configuration changes to default server options 2019-10-04 12:56:36 +02:00
Daniel García Aubert
4e967980a3 Prepare next release ans update news 2019-10-04 12:41:27 +02:00
Daniel García Aubert
93edf07da8 Temporary workaround to not depend on configuration changes 2019-10-04 12:35:12 +02:00
Daniel García Aubert
a684bead92 Rename method 'register' -> 'route' 2019-10-04 12:22:23 +02:00
Daniel García Aubert
dd06de2632 Use new routes configuration 2019-10-04 12:07:58 +02:00
Daniel García Aubert
975f07df99 Use Object.values() 2019-10-02 10:42:29 +02:00
Daniel García Aubert
5fe6845d7c Add comments 2019-10-01 19:48:16 +02:00
Daniel García Aubert
4aa844946d Update environment example files 2019-10-01 19:42:04 +02:00
Daniel García Aubert
3220e3de31 Remove old api configuration paths 2019-10-01 19:34:03 +02:00
Daniel García Aubert
26bba3c5f5 Prepare next release version 2019-10-01 19:31:14 +02:00
Daniel García Aubert
c82a5c38df Fix indentation 2019-10-01 18:20:17 +02:00
Daniel García Aubert
9cfaf6eefc Draft: be able to inject middlewares from configuration 2019-09-30 19:18:36 +02:00
Daniel García Aubert
b881bec668 Release 7.2.0 2019-09-30 17:24:36 +02:00
Raúl Marín
e6f3c63675 Merge pull request #1125 from CartoDB/update_querytables
Update cartodb-query-tables to 0.6.2
2019-09-19 15:08:00 +02:00
Raul Marin
f2afece658 Update cartodb-query-tables to 0.6.3 2019-09-19 13:40:31 +02:00
Raul Marin
b69ceeeee8 Update cartodb-query-tables to 0.6.2 2019-09-18 18:21:38 +02:00
Raúl Marín
b93caa7410 Merge pull request #1123 from Algunenano/query_tables_update
Query tables update
2019-09-18 11:26:51 +02:00
Raul Marin
7476879bde Update cartodb-query-tables to 0.6.1 2019-09-17 13:20:08 +02:00
Daniel G. Aubert
ce884732f3 Merge pull request #1122 from CartoDB/fix-missing-template
Improve named map provider cache
2019-09-16 13:37:52 +02:00
Daniel García Aubert
455932b032 Update NEWS 2019-09-16 13:26:50 +02:00
Daniel García Aubert
68a9b4ccae Typo 2019-09-16 13:09:23 +02:00
Daniel García Aubert
f6c205baf9 Typo 2019-09-16 13:08:10 +02:00
Daniel García Aubert
738d10409f Style 2019-09-16 11:35:40 +02:00
Daniel García Aubert
89c5a3e0a9 Merge branch 'master' into fix-missing-template 2019-09-16 11:30:01 +02:00
Daniel García Aubert
5dac9d956c Add test 2019-09-16 11:18:50 +02:00
Daniel García Aubert
c19c723795 Add named map providers reporter to gather some stats 2019-09-13 20:01:03 +02:00
Daniel García Aubert
788cd9d6fb Be explicit while forwarding parametes 2019-09-13 18:15:11 +02:00
Daniel García Aubert
824d41ef0f Consitent quotes 2019-09-13 18:11:47 +02:00
Daniel García Aubert
329b5d9b9e Use ES6 class syntax 2019-09-13 18:07:50 +02:00
Daniel García Aubert
b55c2ec55c Use template string 2019-09-13 18:03:39 +02:00
Daniel García Aubert
d99e5a44f5 Use const instead of var 2019-09-13 18:00:13 +02:00
Daniel García Aubert
e8d5e42300 Use Object.assign() instead of _.defaults() 2019-09-13 17:58:23 +02:00
Daniel García Aubert
c0afd42fa2 Use template strings instead of dot module 2019-09-13 17:53:10 +02:00
Daniel García Aubert
1bb6a2ac0d Move invalidation closer to its definition 2019-09-13 17:42:56 +02:00
Daniel García Aubert
3d2f554be9 Use early return pattern 2019-09-13 16:53:53 +02:00
Raul Marin
a673e6d138 Update dependencies 2019-09-13 16:32:37 +02:00
Raul Marin
f9b6e92745 Stop throwing up warnings during testing
Yeah, I test with different repos and branches. Big deal. Shut up.
2019-09-13 16:26:46 +02:00
Daniel García Aubert
6229455d25 Remove mechanism to reset named map's provider as, in the end, it's reading from storage (redis) always so cache isn't doing its job. There is already a mechanism to invalidate cache entry when a template is modified (see template-maps emits on "update" and "delete", and listeners attached at server startup) 2019-09-12 20:34:18 +02:00
Daniel García Aubert
9d6726227a Add maxAge param to lru-cache to be able to refresh entries when staled 2019-09-12 18:02:13 +02:00
Daniel García Aubert
64b4efef17 Do not cache map template CRUD errors in Named Map provider 2019-09-12 17:23:19 +02:00
Pablo Alonso
eb71601cd6 Merge pull request #1121 from CartoDB/professional-plan-renaming
Professional -> Individual
2019-09-10 16:31:01 +02:00
Daniel G. Aubert
0297e09c17 Merge pull request #1120 from CartoDB/improve-metadata-sample
Improve efficiency of query samples (esp. for FDW's)
2019-09-04 12:37:41 +02:00
Daniel García Aubert
8f6447b67e Update NEWS 2019-09-04 12:30:12 +02:00
Pablo Alonso Garcia
4ae4ce477f Professional -> Individual 2019-09-02 17:32:06 +02:00
Daniel García Aubert
7bf5deb4c1 Styling 2019-09-02 16:40:43 +02:00
Daniel García Aubert
2fbd9893bd Going green: do not fail when source is empty 2019-09-02 14:09:13 +02:00
Daniel García Aubert
5a01c1c5eb Going red: test to avoid error when the source table is empty 2019-09-02 13:38:28 +02:00
Daniel García Aubert
9a85b661b0 Remove safe limit 2019-08-23 18:04:19 +02:00
Daniel García Aubert
d4d981909b Remove unused code 2019-08-23 17:43:20 +02:00
Daniel García Aubert
16035131bc Rename method 2019-08-23 17:25:37 +02:00
Daniel García Aubert
b2adb8f058 Use substituteDummyTokens 2019-08-23 17:21:01 +02:00
Daniel García Aubert
780cb80c8c Move method 2019-08-23 17:16:35 +02:00
Daniel García Aubert
2a8a8f6e6a Export methods to get max, min, values od a column and sample based on a range 2019-08-23 17:10:46 +02:00
Daniel García Aubert
850bda9669 Use modified sample method 2019-08-23 17:09:53 +02:00
Daniel García Aubert
25e3395580 Modify sample metadata 2019-08-23 17:09:24 +02:00
Román Jiménez
71dba04d83 Merge pull request #1119 from CartoDB/fix-curl-docs-windows
Fix cURL docs for Windows users by using files
2019-08-23 11:08:15 +02:00
Román Jiménez
2a3312e779 Fix cURL docs for Windows users by using files 2019-08-22 18:12:27 +02:00
Daniel G. Aubert
c4484dcc54 Merge pull request #1115 from CartoDB/upgrade-windshaft-5.6.0
Update windshaft to version 5.6.0
2019-07-30 12:24:08 +02:00
Daniel García Aubert
61883b13ef Update windshaft to version 5.6.0 2019-07-30 12:00:28 +02:00
Daniel García Aubert
a220af4fad Please jshint 2019-07-29 19:20:38 +02:00
Daniel García Aubert
945c122dda Update windshaft devel branch 2019-07-29 19:14:27 +02:00
Daniel García Aubert
61b66e88d5 Update NEWS 2019-07-23 18:08:48 +02:00
Daniel G. Aubert
9dfd5f3012 Merge pull request #1114 from CartoDB/upgrade-windshaft-5.5.1
Upgrade windshaft to version 5.5.1
2019-07-23 15:22:28 +02:00
Daniel García Aubert
ff634e32db Upgrade windshaft to version 5.5.1 2019-07-23 13:47:56 +02:00
Daniel García Aubert
3b583ebd56 Update windshaft#master 2019-07-23 12:15:49 +02:00
Daniel García Aubert
1a9b410540 Update to master branch 2019-07-23 11:14:40 +02:00
Daniel García Aubert
d7a439477c Use https 2019-07-23 11:03:55 +02:00
Daniel García Aubert
c7f3da237c Upgrade windshaft to devel branch with fix 2019-07-23 09:13:09 +02:00
Daniel García Aubert
da144de57b Update windshaft devel branch 2019-07-22 17:14:31 +02:00
Raúl Marín
58d38682eb Merge pull request #1113 from Algunenano/audit_dependencies
package-lock.json: Update js-yaml and lodash
2019-07-16 16:29:44 +02:00
Raul Marin
402579f7e2 package-lock.json: Update js-yaml and lodash 2019-07-16 16:11:03 +02:00
Raúl Marín
ebf373e680 Merge pull request #1111 from Algunenano/cartodbless
Render MVTs and aggregations without cartodb-postgresql
2019-07-16 16:06:40 +02:00
Raul Marin
ffe347cfdc package.json: Revert changes to match master 2019-07-16 13:44:13 +02:00
Raul Marin
b572b979a1 Style 2019-07-16 13:43:46 +02:00
Raul Marin
de49aa0bd4 Aggregation: Style improvements 2019-07-16 12:49:09 +02:00
Raul Marin
286daa9bec Simplify aggregation templates 2019-07-16 12:49:09 +02:00
Raul Marin
65beb6e460 Tweak the tests to accept Mapnik precision as valid 2019-07-16 12:49:09 +02:00
Raul Marin
63b6af2ac7 Query utils: Use webmercator utils, reuse code and always substitute tokens 2019-07-16 12:49:09 +02:00
Raul Marin
bdbe132311 Update lodash 2019-07-16 12:49:09 +02:00
Raul Marin
492bcbfdaa Aggregation tests: Enable mapnik and rework the complete cells test
Before it used to test exact tiles, now it test that if a cell/value is included
it will contain exactly the features that we expect
2019-07-16 12:48:58 +02:00
Raul Marin
46600bf4fc Please jshint 2019-07-16 12:48:58 +02:00
Raul Marin
aed456bf32 Cluster: Use new webmercator utilities 2019-07-16 12:48:58 +02:00
Raul Marin
d3e807583a Use proper mode 2019-07-16 12:48:58 +02:00
Raul Marin
262f957218 Aggregation: Improve speeeeeeed 2019-07-16 12:48:58 +02:00
Raul Marin
8454eef6e9 Aggregation: Extract the query to get the grid data 2019-07-16 12:48:58 +02:00
Raul Marin
892479d9b9 API changes 2019-07-16 12:48:58 +02:00
Raul Marin
5e24f650af Rework how aggregations are calculated
Pending fixing Mapnik tiles (pg-mvt work ok)
2019-07-16 12:48:12 +02:00
Raul Marin
de38f1f6fd Tests: Avoid using st_buffer(geography)
It's really slow with PROJ6 since it involves creating different projections for almost each point,
and that's particularly slow in the new release
2019-07-16 12:48:12 +02:00
Raul Marin
a3e8f45552 WIP to change how aggregations are calculated 2019-07-16 12:48:12 +02:00
Raul Marin
cd8624ae2d Improve subquery naming 2019-07-16 12:48:12 +02:00
Raul Marin
7b731a24d1 Overviews Adapter: Do not check overviews if using MVT pure style or aggregations 2019-07-16 12:48:12 +02:00
Daniel G. Aubert
f9bd3d39f0 Merge pull request #1112 from CartoDB/upgrade-windshaft-5.5.0
Upgrade windshaft to version 5.5.0
2019-07-16 12:38:52 +02:00
Daniel García Aubert
dbc926b0b8 Upgrade windshaft to version 5.5.0 2019-07-16 12:27:49 +02:00
Daniel G. Aubert
0f1a3dfb34 Merge pull request #1055 from CartoDB/1054-test
Test for time dimension hour format
2019-07-11 16:04:06 +02:00
Daniel G. Aubert
cbb9285fb3 Merge pull request #863 from CartoDB/cartofante
removing raster image on timeout error
2019-07-11 15:59:38 +02:00
Daniel García Aubert
d7412aab45 Update NEWS 2019-07-09 16:53:19 +02:00
Daniel G. Aubert
d8ca29509f Merge pull request #1109 from CartoDB/update-query-tables
[WIP] Update cartodb-query-tables
2019-07-09 16:50:16 +02:00
Daniel García Aubert
619cad9c35 Typo 2019-07-09 15:44:34 +02:00
Daniel García Aubert
bca723bcf3 PLease jshint 2019-07-09 14:59:16 +02:00
Daniel García Aubert
ef39f23d1f Fix tests to use map-config builder properly 2019-07-09 14:47:40 +02:00
Daniel García Aubert
c066e2c3cf Update cartodb-query-tables to version 0.5.0 2019-07-09 12:45:33 +02:00
Daniel García Aubert
45af291e6a Remove test filter 2019-07-08 18:08:08 +02:00
Daniel García Aubert
a84184852e Going green: skip analyses table while computing max-age directive 2019-07-08 18:05:30 +02:00
Daniel García Aubert
6cdb872bb5 Going red: add test to check the bad behavour of max-age directive when an analysis table is in affected tables of the map 2019-07-08 17:55:04 +02:00
Daniel G. Aubert
27b76aefd2 Merge pull request #1107 from CartoDB/max-age-directive
Set directive 'max-age' to a fallback value
2019-07-05 15:38:33 +02:00
Daniel García Aubert
8820e34870 Update news 2019-07-05 15:31:17 +02:00
Daniel García Aubert
4def4b0341 Improve condition 2019-07-04 16:41:30 +02:00
Daniel García Aubert
ec0c0eb810 Improve readability 2019-07-04 16:24:17 +02:00
Daniel García Aubert
5ca498d0f3 Typo 2019-07-04 16:18:43 +02:00
Daniel García Aubert
a894194b6b Add more specific tests 2019-07-04 15:58:39 +02:00
Daniel García Aubert
2e8a5d0d86 Add test 2019-07-04 15:34:37 +02:00
Daniel García Aubert
a374deaf30 Please linter 2019-07-03 17:16:09 +02:00
Daniel García Aubert
bc29587c55 Set directive 'max-age' to 5 min when there are affacted tables where we can't know when were updated for the last time, e.g: non cartodified tables or foreing tables without cartodb support 2019-07-03 17:15:14 +02:00
Simon Martín
9cb149fa32 Merge pull request #1103 from CartoDB/fix-torque-cartocss
Upgrade windshaft to version 5.4.0
2019-06-25 11:17:14 +02:00
Simon Martín
412c4af7b0 Upgrade windshaft to version 5.4.0 2019-06-25 11:01:02 +02:00
Simon Martín
28ff0bdfc4 updating lock2 2019-06-24 17:33:32 +02:00
Simon Martín
f9250cda1a updating lock 2019-06-24 17:24:37 +02:00
Raúl Marín
b821b9b038 Merge pull request #1105 from Algunenano/carto-package-mapnik16
carto-package.json: Update mapnik dependency to match what's installed
2019-06-24 17:13:22 +02:00
Raul Marin
6f35f9cbbb carto-package.json: Update mapnik dependency to match what's installed 2019-06-24 17:05:06 +02:00
Simon Martín
23d9cd81c8 test torque fix 2019-06-21 15:26:22 +02:00
Daniel G. Aubert
dc63edf0c7 Merge pull request #1099 from CartoDB/abaculus-cartofy
Upgrade windshaft: integrate abaculus into cartonik
2019-06-17 15:52:46 +02:00
Daniel García Aubert
ab6ee52b43 Merge branch 'master' into abaculus-cartofy 2019-06-17 15:42:12 +02:00
Daniel García Aubert
3121d907c1 Update NEWS 2019-06-17 15:40:31 +02:00
Daniel García Aubert
b09a35f272 Upgrade windshaft to version 5.3.0 2019-06-17 15:37:51 +02:00
Daniel García Aubert
f21eda2b40 Adapt endpoints to the new preview interface 2019-06-17 10:43:30 +02:00
Daniel García Aubert
ef4370c213 Update devel branch 2019-06-12 18:33:00 +02:00
Rafa de la Torre
9f03e978dd Merge pull request #1102 from CartoDB/update-turbo-carto-0.21.2
Update turbo-carto to 0.21.2
2019-06-12 10:54:04 +02:00
Rafa de la Torre
54190a9cd2 Update turbo-carto to 0.21.2 2019-06-12 10:37:53 +02:00
Daniel García Aubert
f43ccd4c4e Update devel branch 2019-06-10 19:04:22 +02:00
Daniel García Aubert
20fe04de38 Do not get headers from abaculus 2019-06-10 13:16:05 +02:00
Daniel García Aubert
dc16f4cebf Update windshaft devel branch 2019-06-10 12:49:56 +02:00
Raúl Marín
bfaf764f13 Merge pull request #1098 from Algunenano/extension_changes
Adapt to extension changes
2019-06-03 17:53:53 +02:00
Raul Marin
62d9fb1365 Docker: Install cartodb extension for testing purposes 2019-06-03 16:44:59 +02:00
Raul Marin
9f2b5330d5 Install the cartodb extension directly 2019-06-03 16:23:41 +02:00
Raul Marin
9a552a7cc4 Adapt to fully qualification in the extension 2019-06-03 13:41:22 +02:00
Raúl Marín
08998a3d17 Merge pull request #1096 from CartoDB/mapnik15
Mapnik 3.0.15
2019-05-21 12:34:12 +02:00
Raul Marin
b41f43f4bf Mapnik 3.0.15 2019-05-21 12:06:07 +02:00
Daniel García Aubert
90740146ff Release 7.1.0 2019-05-06 10:40:02 +02:00
Daniel G. Aubert
778eb54890 Merge pull request #1088 from CartoDB/cartonik
Upgrade windshaft to version 5.2.0
2019-04-29 13:24:01 +02:00
Daniel García Aubert
5196d2fed0 Update NEWS 2019-04-29 13:03:15 +02:00
Daniel García Aubert
5e969aa41a Upgrade windshaft to version 5.2.0 2019-04-29 12:46:06 +02:00
Daniel García Aubert
1ac03eeb91 Update windshaft devel branch 2019-04-25 17:55:57 +02:00
Daniel García Aubert
261e6e3307 Merge branch 'master' into cartonik 2019-04-25 15:41:28 +02:00
Raúl Marín
e38f8b6133 Merge pull request #1095 from Algunenano/blessed_fix_deps
Update package-lock.json to point to CARTOs forks
2019-04-25 15:38:48 +02:00
Raul Marin
bc4204243c Update package-lock.json to point to CARTOs forks 2019-04-25 14:50:11 +02:00
Daniel García Aubert
f93ea0e95c Merge branch 'master' into cartonik 2019-04-25 14:14:16 +02:00
Raúl Marín
b90e15207f Merge pull request #1094 from CartoDB/mapnik13
Update node-mapnik to 3.6.2-carto.13
2019-04-15 13:43:27 +02:00
Raúl Marín
19da16229c Merge pull request #1092 from CartoDB/fix-typo-patch-1
fix typo
2019-04-15 13:27:37 +02:00
Raul Marin
73c29660d6 Update @carto/mapnik to 3.6.2-carto.13 2019-04-15 13:23:06 +02:00
Raul Marin
6549a3a023 Agg tests: Sort before compare to avoid failures due to paralellism 2019-04-10 19:32:32 +02:00
Mario de Frutos Dieguez
4d30fb57d8 Remove unused travisci variable 2019-04-10 16:43:24 +02:00
Mario de Frutos Dieguez
022e6a2f89 Tests using PG11 and Postgis 2.5 (#1093) 2019-04-10 13:06:39 +02:00
Daniel García Aubert
da613df71c Update windshaft devel branch 2019-04-02 17:01:04 +02:00
Daniel García Aubert
66882b3c25 Merge branch 'master' into cartonik 2019-04-02 16:45:27 +02:00
Daniel G. Aubert
9285764e31 Merge pull request #1091 from CartoDB/upgrade-windshaft-next
Upgrade windshaft to version 5.1.0
2019-04-02 12:52:34 +02:00
Daniel García Aubert
835f55e563 Update NEWS 2019-04-02 12:42:13 +02:00
Daniel García Aubert
ef1bd7502f Use released version of Windhshaft 2019-04-02 12:34:31 +02:00
Daniel García Aubert
320d3c196d Update windshaft devel branch 2019-04-01 11:34:06 +02:00
Iñigo Medina (aka MacGyver)
9d88a4659f fix typo
The output in the Developer Center is not being properly rendered just because of a typo in the headline format.
2019-03-29 19:03:25 +01:00
Daniel García Aubert
dae33bab5e Update fixtures 2019-03-29 18:56:18 +01:00
Daniel García Aubert
c0a305babf Update windshaft devel branch 2019-03-29 18:20:48 +01:00
Daniel G. Aubert
4ffbcea819 Merge pull request #1090 from CartoDB/graceful-shutdown
Use semver for cheking dependencies version
2019-03-29 15:40:12 +01:00
Daniel García Aubert
6808ab496a Use semver for cheking dependencies version 2019-03-29 15:30:29 +01:00
Daniel G. Aubert
40d43331e4 Merge pull request #1089 from CartoDB/graceful-shutdown
Implement graceful shutdown
2019-03-29 15:23:27 +01:00
Daniel García Aubert
674c276b57 Upgrade windshaft to version 5 2019-03-29 13:36:16 +01:00
Daniel García Aubert
5fdc501836 Upgrade camshaft to version 0.64.0 2019-03-29 13:26:38 +01:00
Daniel García Aubert
c3b1b469b2 Update NEWS 2019-03-29 13:21:35 +01:00
Daniel García Aubert
c30a81acbe Update NEWS 2019-03-29 13:18:40 +01:00
Daniel García Aubert
035acb343e Fix uncaught exception: TypeError: Cannot read property 'id' of undefined 2019-03-27 11:45:47 +01:00
Daniel García Aubert
53b19d576c Update dynamic Node.js version check 2019-03-26 19:14:39 +01:00
Daniel García Aubert
7efb8abd97 Use code while exiting 2019-03-26 19:06:10 +01:00
Daniel García Aubert
b314acf5b5 PLase jshint 2019-03-26 18:57:49 +01:00
Daniel García Aubert
b222dd15c0 Handle ENOMEM signal emitted by grainstore 2019-03-26 18:54:42 +01:00
Daniel García Aubert
01212920ae Draft 2019-03-26 18:47:57 +01:00
Daniel García Aubert
4b2d736f0e Update windshaft devel branch 2019-03-26 17:33:45 +01:00
Daniel García Aubert
57d5b17a84 Update windshaft devel branch 2019-03-26 09:54:19 +01:00
Daniel García Aubert
791d0f5787 Update windshaft devel branch 2019-03-25 19:27:52 +01:00
Daniel García Aubert
fa9d604fa3 Fix broken test 2019-03-22 19:09:58 +01:00
Daniel García Aubert
bdb55e4b21 Update windshaft devel branch 2019-03-22 18:17:06 +01:00
Daniel García Aubert
e2d707b158 Update windshaft devel branch 2019-03-22 17:36:01 +01:00
Daniel García Aubert
7963681585 Update windshaft devel branch 2019-03-21 17:18:48 +01:00
Daniel García Aubert
b0158d9388 Update cartonik 2019-03-21 12:08:34 +01:00
Daniel G. Aubert
0e86c4aae8 Merge pull request #1087 from CartoDB/upgrade-windshaft-4.13.5
Upgrade windshaft to version 4.13.5
2019-03-20 10:25:08 +01:00
Daniel García Aubert
2f838f0b6a Update NEWS 2019-03-19 18:39:56 +01:00
Daniel García Aubert
362d48ab81 Upgrade windshaft to version 4.13.5 2019-03-19 18:34:11 +01:00
Daniel G. Aubert
8d7b3beb09 Merge pull request #1086 from CartoDB/cartofy
Upgrade windshaft to version 4.13.4
2019-03-19 15:55:56 +01:00
Daniel García Aubert
6d360a8b03 Update NEWs 2019-03-19 15:45:20 +01:00
Daniel García Aubert
bf53a905a2 Upgrade windshaft to version 4.13.4 2019-03-19 13:41:07 +01:00
Daniel García Aubert
290cdd2692 Update windshaft 2019-03-18 12:46:27 +01:00
Daniel García Aubert
00570a21f5 Use devel branch of windshaft 2019-03-17 18:01:41 +01:00
Raúl Marín
9a98422076 Merge pull request #1082 from CartoDB/1073-aggregation-false
Fix boolean aggregation layer option
2019-03-14 17:14:26 +01:00
Raul Marin
ab9cfee7b1 Update NEWS 2019-03-14 17:02:23 +01:00
Raul Marin
ae59c4f996 Merge remote-tracking branch 'blessed/master' into 1073-aggregation-false 2019-03-14 17:01:07 +01:00
Raúl Marín
514fc908b9 Merge pull request #1080 from Algunenano/histogram_irq_improvement
Numeric histogram performance improvement
2019-03-14 15:23:44 +01:00
Raul Marin
59107496b4 Update NEWS 2019-03-14 15:17:42 +01:00
Raul Marin
8db090ae9c Numeric histogram: Test when start and end are provided but not bins 2019-03-14 15:16:23 +01:00
Raul Marin
730076469e Numeric histogram: Simplify bin calculation 2019-03-14 15:16:23 +01:00
Raul Marin
6241b23d4f Histogram: Speed up IRQ calculation 2019-03-14 15:16:23 +01:00
Daniel G. Aubert
e65872d5df Merge pull request #1085 from CartoDB/upgrade-windshaft-4.13.3
Upgrade windshaft to version 4.13.3
2019-03-14 12:00:01 +01:00
Daniel García Aubert
eaa38b7676 Upgrade windshaft to version 4.13.3 2019-03-13 18:52:17 +01:00
Daniel G. Aubert
f76fe9efc1 Merge pull request #1084 from CartoDB/fix-cluster-test-for-pg11
Place points out of boundaries to avoid conficlts with PG11
2019-03-12 15:27:54 +01:00
Daniel García Aubert
6b2ad8826b Move points to avoid x/y axes 2019-03-12 15:18:31 +01:00
Daniel García Aubert
8324d4c4c2 Place points out of boundaries to avoid conficlts with PG11 2019-03-12 10:35:16 +01:00
Daniel G. Aubert
2821d797a9 Merge pull request #1083 from CartoDB/cluster-refactor
Cluster refactor
2019-03-11 19:10:40 +01:00
Daniel García Aubert
367ca399c8 Improve readability 2019-03-11 18:53:47 +01:00
Daniel García Aubert
d86b01ba33 Add debug statement 2019-03-11 18:09:41 +01:00
Daniel García Aubert
0aa3b288a0 Improve validation 2019-03-11 18:04:47 +01:00
Daniel García Aubert
589996b79c Reduce complexity 2019-03-11 17:53:34 +01:00
Daniel García Aubert
49104a6add Reduce complexity by extracting function to validate expressions 2019-03-11 17:25:29 +01:00
Daniel García Aubert
8051dc5110 Reduce complexity by extracting validation condition to its function 2019-03-11 17:14:07 +01:00
Daniel García Aubert
fecedfdc68 Reduce complexity by extracting validation to a function 2019-03-11 17:06:04 +01:00
Daniel García Aubert
f0c82f21d2 Reduce complexity by extracting a complex condition to a function 2019-03-11 17:01:13 +01:00
cillas
9f71fcf255 Merge pull request #879 from CartoDB/developer-center
New docs folder for developer center
2019-03-07 18:35:20 +01:00
Javier Goizueta
c91b28ee92 Lint fixes 2019-03-06 18:32:17 +01:00
Javier Goizueta
113b3728b1 Fix support of boolean aggregation layer option 2019-03-06 18:14:15 +01:00
Javier Goizueta
cf193a71b2 Add tests for enabling default aggregation 2019-03-06 15:28:38 +01:00
csubira
2d37d4bf9d Fix typo in named maps guide 2019-03-06 15:26:14 +01:00
csubira
a768575fea Add multilayer api file as internal doc 2019-03-06 14:55:41 +01:00
csubira
51ff565c5f Update links to deprecated docs site 2019-03-06 14:54:48 +01:00
Javier Goizueta
c5f5f43ccb Fix test for disabling aggregations
See #1073
2019-03-05 22:17:04 +01:00
csubira
df7b5db47b Remove extra line 2019-03-04 12:26:04 +01:00
csubira
98121e0e64 Add liquid raw to fix block code 2019-03-04 12:20:51 +01:00
csubira
e74f734546 Revert addition due to conflict when deploying devcenter 2019-03-01 18:24:11 +01:00
Daniel G. Aubert
d836b75dc4 Merge pull request #1077 from CartoDB/mvt-list-aggregated-features
Experimental support for listing features in a grid
2019-03-01 18:06:38 +01:00
Daniel García Aubert
47321aebc4 Updates NEWS and next release version 2019-03-01 17:53:15 +01:00
Daniel García Aubert
2a0287b358 Add todos 2019-03-01 17:49:26 +01:00
Daniel García Aubert
f5fb60aa56 Filter output 2019-03-01 17:34:32 +01:00
Daniel García Aubert
a412e37a32 Improve test descriptions 2019-03-01 17:21:55 +01:00
Daniel García Aubert
dcf147cdfb linter 2019-03-01 17:05:35 +01:00
Daniel García Aubert
f9e5d9d0a9 Validate aggregation expresions 2019-03-01 17:02:06 +01:00
Daniel García Aubert
57a229655c Implement aggregation functions 2019-03-01 15:45:38 +01:00
csubira
a92a2b7291 Remove older doc files 2019-03-01 15:25:16 +01:00
csubira
d9fe5bf388 Update with latest changes 2019-03-01 15:19:27 +01:00
Daniel García Aubert
6dadb1bf6f Validate aggregation input 2019-03-01 15:17:22 +01:00
csubira
b7cf5ca174 Merge branch 'master' of github.com:CartoDB/Windshaft-cartodb into developer-center 2019-03-01 15:06:41 +01:00
Daniel García Aubert
77d5d8ebd4 Be able to aggregate by a field 2019-03-01 11:21:18 +01:00
Daniel García Aubert
92e62069d4 Improve error handling 2019-02-28 12:13:15 +01:00
Daniel García Aubert
32938eeab7 Validated only aggregated layers can be requested by the new endpoint 2019-02-27 18:54:21 +01:00
Daniel García Aubert
6531770e48 Remove subtitution tokens 2019-02-27 12:47:20 +01:00
Daniel García Aubert
561be2e5e8 Add tests 2019-02-27 12:43:26 +01:00
Daniel García Aubert
b87298bad9 Fix resolution definition and use zoom as path param 2019-02-27 12:42:54 +01:00
Daniel García Aubert
c3df075d91 Draft 2019-02-26 19:19:44 +01:00
Daniel García Aubert
f82e403180 Implement query to get features of a cluster for an aggregated map from @jgoizueta's cluster query 2019-02-25 19:40:18 +01:00
Daniel García Aubert
afd81a7814 Stubs next version 2019-02-22 13:09:00 +01:00
Daniel García Aubert
ca7f0ad4a6 Release 7.0.0 2019-02-22 12:52:10 +01:00
Daniel G. Aubert
4fc4390173 Merge pull request #1076 from CartoDB/drop-support-nodejs-6
Drop suppor for Node.js 6, npm 3, yarn and redis 3
2019-02-22 12:17:05 +01:00
Daniel García Aubert
fff54f021c Improve doc 2019-02-22 12:11:14 +01:00
Daniel García Aubert
6fee16fe5e Update comments and config 2019-02-22 10:49:22 +01:00
Daniel García Aubert
5f43db2e36 Remove POSTGIS_VERSION env variable and run test using mvt renderer always 2019-02-22 08:31:22 +01:00
Daniel García Aubert
561bdb3938 Improve MD formatting 2019-02-22 07:53:18 +01:00
Daniel García Aubert
47576358a2 Remove hack of stripping PARALLEL labels for PG releases before 9.6 2019-02-22 07:52:39 +01:00
Daniel García Aubert
582947accd Update release date 2019-02-21 18:45:19 +01:00
Daniel García Aubert
30f4b58ced Add npm as dependency 2019-02-21 18:26:56 +01:00
Daniel García Aubert
227a271bea Typo 2019-02-21 18:21:37 +01:00
Daniel García Aubert
5455d2997f Remove items in requirements list 2019-02-21 18:11:27 +01:00
Daniel García Aubert
241bb511ea Drop support for Redis 3, Postgres 9.5 and PostGIS 2.2 2019-02-21 17:55:58 +01:00
Daniel García Aubert
85e19bf16c Drop suppor for Node.js 6, npm 3, yarn and redis 3 2019-02-21 17:34:29 +01:00
Rafa de la Torre
e93dd982b9 Merge pull request #1072 from CartoDB/upgrade-camshaft-0.63.4
Upgrade camshaft 0.63.4
2019-02-13 14:57:47 +01:00
Rafa de la Torre
535b52df55 Update package-lock.json (node 10) camshaft@0.63.4 2019-02-13 14:39:44 +01:00
Rafa de la Torre
a04782b63e Update yarn camshaft@0.63.4 2019-02-13 14:39:44 +01:00
Rafa de la Torre
feb1e53a4d Upgrade camshaft 0.63.4 2019-02-13 14:39:30 +01:00
Simon Martín
705c001681 Merge pull request #1070 from CartoDB/docker-new-node-version
Dynamic node version in Dockerfile
2019-02-13 10:55:47 +01:00
Rafa de la Torre
a973fc981a Merge pull request #1071 from CartoDB/upgrade-camshaft-0.63.3
Upgrade camshaft 0.63.3
2019-02-13 09:36:52 +01:00
Daniel G. Aubert
77cbe2b545 version 6 to 6.9.2 in travis
Co-Authored-By: oleurud <oleurud@pm.me>
2019-02-13 09:27:16 +01:00
Daniel G. Aubert
0b5ef6a5e1 version 6 to 6.9.2 in travis
Co-Authored-By: oleurud <oleurud@pm.me>
2019-02-13 09:27:08 +01:00
Simon Martín
97f813a777 extracting postgres start from Node.js installation file 2019-02-12 18:51:33 +01:00
Rafa de la Torre
a242588d95 Update package-lock.json (node 10) camshaft@0.63.3 2019-02-12 18:43:32 +01:00
Simon Martín
b2f5e72bf1 renaming var 2019-02-12 18:34:25 +01:00
Rafa de la Torre
0daf8dcd8d Update yarn camshaft@0.63.3 2019-02-12 18:34:17 +01:00
Rafa de la Torre
79e886cfb9 Update camshaft@0.63.3 2019-02-12 18:29:05 +01:00
Simon Martín
4f6d04a3ae docker bash with dynamic image 2019-02-12 18:21:00 +01:00
Simon Martín
0e26d5ba5a travis with dynamic image 2019-02-12 18:20:43 +01:00
Simon Martín
915e0f8483 running tests with dynamic image 2019-02-12 18:20:32 +01:00
Simon Martín
4058d9fbc7 typo 2019-02-12 18:15:32 +01:00
Simon Martín
6c6ff42879 renaming docker nodejs installation script 2019-02-12 18:13:49 +01:00
Simon Martín
450f74b387 dockerfile CMD sh file 2019-02-12 16:55:17 +01:00
Simon Martín
f684994868 new docker file with nvm 2019-02-12 16:54:50 +01:00
Alejandro Guirao
be4240623a Pin Mapnik version and set crankshaft minor version 2019-02-12 15:30:55 +01:00
Simon Martín
4b5e003f33 fix bad file name 2019-02-12 15:06:33 +01:00
Simon Martín
6c7c0eb7e7 making nodejs version dynamic and LTS as default 2019-02-12 15:02:59 +01:00
Simon Martín
1ba6480110 using nvm 2019-02-12 14:46:41 +01:00
Daniel G. Aubert
af31962b2d Merge pull request #1069 from CartoDB/refactor
Upgrade windshaft to version 4.13.1
2019-02-11 13:49:50 +01:00
Daniel García Aubert
f134bd459e Update yarn.lock 2019-02-11 13:35:53 +01:00
Daniel García Aubert
01d02f8c2e Update windshaft to version 4.13.1 2019-02-11 13:33:50 +01:00
Daniel García Aubert
092bed6d9d Do not use caret symbol 2019-02-11 13:25:13 +01:00
Daniel García Aubert
8d9b8aced2 Upgrade windshaft to version 4.13.1 2019-02-11 13:19:34 +01:00
Daniel García Aubert
2856703acc Update windshaft devel branch 2019-02-08 18:44:59 +01:00
Daniel García Aubert
14b8a72551 Update windshaft devel branch 2019-02-07 19:16:36 +01:00
Daniel García Aubert
0125dcdd1d Update windshaft devel branch 2019-02-07 18:32:15 +01:00
Daniel García Aubert
6a15d30579 Update windshaft devel branch 2019-02-06 17:05:33 +01:00
Daniel García Aubert
3dcefa3ea1 Update windshaft devel dep 2019-02-05 08:55:34 +01:00
Daniel García Aubert
b3a995f880 Merge branch 'master' into refactor 2019-02-05 08:49:59 +01:00
Daniel García Aubert
d40be45e9a Update windshaft devel dep 2019-02-04 18:53:38 +01:00
Daniel G. Aubert
ec952d88cc Merge pull request #1068 from CartoDB/dynamic-map-pool
Handle 'max waitingClients count exceeded' error as: "429 You are over platfor's limits"
2019-02-04 14:09:52 +01:00
Daniel García Aubert
3983dfe004 Update windshaft to version 4.13.0 2019-02-04 13:54:41 +01:00
Daniel García Aubert
e1c4f8445c Update tilelive-mapnik to development version 2019-02-04 13:52:03 +01:00
Daniel García Aubert
2a68e0565e Update windshaft dep 2019-02-01 17:43:47 +01:00
Daniel García Aubert
f4b6173da9 Fix test 2019-01-30 16:54:19 +01:00
Daniel García Aubert
63c95df81c Lint 2019-01-30 16:36:08 +01:00
Daniel García Aubert
065f9c0a53 Add subtype to the limit error 2019-01-30 16:15:29 +01:00
Daniel García Aubert
abe28937ca Lint 2019-01-30 15:28:43 +01:00
Daniel García Aubert
77b7e03869 Update NEWS 2019-01-30 15:18:41 +01:00
Daniel García Aubert
d5af1bd9a2 Implement tests to check the limit error is the expected one 2019-01-30 15:15:07 +01:00
Daniel García Aubert
86f313ec52 Update windshaft 2019-01-30 10:49:57 +01:00
Daniel García Aubert
2e85e130c8 Be able to customize max waiting workers parameter 2019-01-30 10:41:39 +01:00
Daniel García Aubert
d70a87b299 Handle 'max waitingClients count exceeded' error as 429 Too many requests 2019-01-30 10:27:00 +01:00
Daniel García Aubert
c4576564e5 Update windshaft to a development version 2019-01-29 17:47:12 +01:00
Daniel G. Aubert
f82a7a148b Merge pull request #1067 from CartoDB/audit-dependencies
Audit dependencies and fix critical vulns
2019-01-24 13:26:38 +01:00
Daniel García Aubert
b4431d823c Update NEWS 2019-01-24 13:02:42 +01:00
Daniel García Aubert
0168aa3a61 Update winshaft to version 4.12.3 2019-01-24 13:02:09 +01:00
Daniel García Aubert
2064b14015 Update engine compatible versions 2019-01-24 12:14:32 +01:00
Daniel García Aubert
aeea83d5f5 Update NEWS 2019-01-23 19:03:21 +01:00
Daniel García Aubert
221bf0cefd Update winshaft to version 4.12.2 2019-01-23 19:01:51 +01:00
Daniel García Aubert
2899f62d95 Don't use carets 2019-01-17 17:19:42 +01:00
Daniel García Aubert
442ca34eb1 Update NEWS 2019-01-17 17:17:21 +01:00
Daniel García Aubert
0202a17138 Upgrade jshint to version 2.9.7 2019-01-17 16:08:01 +01:00
Daniel García Aubert
37645ec663 Update mocha to version 5.2.0 2019-01-17 15:53:03 +01:00
Iñigo Medina (aka MacGyver)
b7aed2a85d Merge pull request #1064 from CartoDB/dc-updating-rate-limits
rate limits new values
2019-01-11 14:23:58 +01:00
Simon Martín
a47c5b5568 rate limits new values 2019-01-11 13:53:11 +01:00
Alberto Romeu
56eb4a8dc3 Merge pull request #1063 from CartoDB/cors-authorization-headers
Adding Authorization to Access-Control-Allow-Headers
2019-01-11 12:35:36 +01:00
Simon Martín
7b029c890a NEWS 2019-01-10 16:57:30 +01:00
Simon Martín
644b4232ca adding Authorization to Access-Control-Allow-Headers 2019-01-10 16:56:07 +01:00
Daniel G. Aubert
ff27e6744e Merge pull request #1062 from CartoDB/gc-stats
Report fine-grained Garbage Collector stats
2019-01-03 16:10:54 +01:00
Daniel García Aubert
fb929e71fc Update docs 2019-01-03 12:27:12 +01:00
Daniel García Aubert
0bd7bd1621 Update yarn.lock 2019-01-03 11:50:17 +01:00
Daniel García Aubert
5cad6e40c4 Get GC stats from dedicated binding 2019-01-03 11:47:54 +01:00
Daniel G. Aubert
3a4984c1ce Merge pull request #1061 from CartoDB/update-doc-nodejs-npm-versions
Update docs
2019-01-02 13:04:20 +01:00
Daniel García Aubert
caa5a648df Add deprecation warning 2019-01-02 12:54:39 +01:00
Daniel García Aubert
8487e4fb52 Update docs 2019-01-02 11:33:23 +01:00
Daniel García Aubert
b508689b53 Stubs next version 2018-12-26 16:57:19 +01:00
Daniel García Aubert
3b4d1bf72a Release 6.5.1 2018-12-26 16:55:35 +01:00
Daniel García Aubert
0bbbdfa092 Update NEWS 2018-12-26 16:54:14 +01:00
Daniel G. Aubert
c1e769ade2 Merge pull request #1060 from CartoDB/fix-carto-package
Fix carto-package.json
2018-12-26 16:52:49 +01:00
Daniel García Aubert
a20ce69028 Fix carto-package.json 2018-12-26 16:48:51 +01:00
Daniel García Aubert
80519cb397 Stubs next version 2018-12-26 15:26:09 +01:00
Daniel García Aubert
7347263dfd Release 6.5.0 2018-12-26 15:23:28 +01:00
Rafa de la Torre
2a3b6b830b Merge pull request #1059 from CartoDB/update-cartodb-psql-0.13.1
Update cartodb-psql to 0.13.1 and related reverse dependenciess (WIP)
2018-12-13 17:22:55 +01:00
Rafa de la Torre
11b299e116 Update NEWS.md 2018-12-13 16:28:37 +01:00
Rafa de la Torre
27eef4ce42 Update NEWS.md 2018-12-13 16:26:07 +01:00
Rafa de la Torre
59badc0137 Update yarn.lock deps 2018-12-13 15:25:57 +01:00
Rafa de la Torre
f49698efa1 Update package-lock.json deps 2018-12-13 15:23:11 +01:00
Rafa de la Torre
19d6cae10d Update cartodb-psql and rdeps (WIP) 2018-12-12 18:45:36 +01:00
Daniel G. Aubert
7057f5a5c2 Merge pull request #1056 from CartoDB/nodejs-10
Support Nodejs 10 LTS
2018-11-22 14:48:46 +01:00
Daniel García Aubert
3e336204df Update NEWS 2018-11-21 18:01:53 +01:00
Daniel García Aubert
3f4ecb195c Update NEWS 2018-11-21 17:51:56 +01:00
Daniel García Aubert
58b528d00a Update NEWS 2018-11-21 17:49:42 +01:00
Daniel García Aubert
2d2060088c Update yarn.lock 2018-11-21 17:43:50 +01:00
Daniel García Aubert
d1667fac73 Upgrade turbo-carto@0.21.0 2018-11-21 17:36:30 +01:00
Daniel García Aubert
98c0b1f9bd Upgrade cartodb-redis@2.1.0 2018-11-21 17:14:03 +01:00
Daniel García Aubert
1d2548a3e6 Upgrade cartodb-query-tables@0.4.0 2018-11-21 16:39:12 +01:00
Daniel García Aubert
3690959be4 Update camshaft@0.63.0 2018-11-21 15:42:12 +01:00
Daniel García Aubert
7de5fd1515 Update yarn.lock 2018-11-21 13:29:32 +01:00
Daniel García Aubert
f9d1e39b7b Update windshaft@4.12.0 2018-11-21 13:19:29 +01:00
Daniel García Aubert
16a0d9707b Update redis-mpool@0.7.0 2018-11-21 13:11:30 +01:00
Daniel García Aubert
6962abfd10 Update cartodb-psql@0.13.0 2018-11-21 13:09:18 +01:00
Daniel García Aubert
dc0d4f0011 Merge branch 'master' into nodejs-10 2018-11-20 11:20:20 +01:00
Daniel G. Aubert
6bcb535d3f Merge pull request #1057 from CartoDB/add-cpu-metrics
Add process CPU usage metrics
2018-11-15 17:59:24 +01:00
Daniel García Aubert
4ad9902601 Add process CPU usage metrics 2018-11-15 17:28:18 +01:00
Daniel García Aubert
2a933788fd Update yarn.lock 2018-11-06 13:27:30 +01:00
Daniel García Aubert
3febf3e357 Use 'npm ci' instead of 'npm install' to be able to install exactly what is in a lockfile 2018-11-06 12:58:51 +01:00
Daniel García Aubert
a8ca80c23c List dependency tree after install in docker tests 2018-11-06 12:35:10 +01:00
Daniel García Aubert
f3b1bb742a Ensure all pg connections are being refreshed 2018-11-06 12:17:39 +01:00
Daniel García Aubert
4d1ed0be27 Update package-lock.json 2018-11-05 19:47:21 +01:00
Daniel García Aubert
af4b9f57f5 Skip just torque database timeout limit 2018-11-05 19:10:08 +01:00
Daniel García Aubert
6e7bd2585f Skip database timeout test 2018-11-05 18:53:00 +01:00
Daniel García Aubert
40ccdfd9b3 Drain pool connection before 2018-11-05 18:37:20 +01:00
Daniel García Aubert
659b0ba889 Use pdql.end with callback 2018-11-05 18:14:26 +01:00
Daniel García Aubert
71b8699f47 Shut down the pool after setting the database timeout 2018-11-05 17:16:22 +01:00
Daniel García Aubert
24c5bbb182 Workaround to drain pg pool effectively 2018-11-05 16:50:52 +01:00
Daniel García Aubert
2eea20b161 Updated cartodb-psql 2018-11-05 16:03:43 +01:00
Daniel García Aubert
f2180576de Remove test filter 2018-11-02 13:57:56 +01:00
Daniel García Aubert
d9039569bd Output yarn version 2018-11-02 13:57:30 +01:00
Daniel García Aubert
4a82d18cc6 Fix docker command 2018-11-02 13:56:43 +01:00
Daniel García Aubert
f8fa78bb8b Output npm version 2018-11-02 13:30:24 +01:00
Daniel García Aubert
babfa9aae3 Revert "Skip test temporally"
This reverts commit ebf2f54cd5.
2018-11-02 13:30:04 +01:00
Daniel García Aubert
ebf2f54cd5 Skip test temporally 2018-11-02 12:39:34 +01:00
Daniel García Aubert
20c1e8ca05 Revert "Revert "Add cache-buster to hit database always""
This reverts commit 60724897cc.
2018-11-02 12:24:45 +01:00
Daniel García Aubert
2a35d51d45 Revert "Set DEBUG env variable to run test"
This reverts commit 7bd188dafb.
2018-11-02 12:24:01 +01:00
Daniel García Aubert
ebe2d2ddab Revert "Add log to debug server option"
This reverts commit b4e57438ed.
2018-11-02 12:23:48 +01:00
Daniel García Aubert
1ee30e9b53 Revert "Move log to debug server option"
This reverts commit 938e3b2b07.
2018-11-02 12:23:36 +01:00
Daniel García Aubert
7527003711 Revert "Move log to debug server option"
This reverts commit 6c3d8dbe64.
2018-11-02 12:23:05 +01:00
Daniel García Aubert
acd0bbc94f Revert "Add log"
This reverts commit 6cc746dc83.
2018-11-02 12:22:41 +01:00
Daniel García Aubert
00e3f331b4 Revert "Do not run test against node 6"
This reverts commit 7a6fbecac4.
2018-11-02 12:20:49 +01:00
Daniel García Aubert
7a6fbecac4 Do not run test against node 6 2018-11-02 12:17:28 +01:00
Daniel García Aubert
6cc746dc83 Add log 2018-11-02 12:01:59 +01:00
Daniel García Aubert
6c3d8dbe64 Move log to debug server option 2018-11-02 11:23:44 +01:00
Daniel García Aubert
938e3b2b07 Move log to debug server option 2018-11-02 11:12:32 +01:00
Daniel García Aubert
b4e57438ed Add log to debug server option 2018-11-02 10:58:17 +01:00
Daniel García Aubert
7bd188dafb Set DEBUG env variable to run test 2018-11-02 10:37:39 +01:00
Daniel García Aubert
60724897cc Revert "Add cache-buster to hit database always"
This reverts commit e03defc30f.
2018-11-02 10:29:19 +01:00
Daniel García Aubert
e03defc30f Add cache-buster to hit database always 2018-11-02 10:21:53 +01:00
Daniel García Aubert
3bb1f893af Test only 2018-11-01 15:05:38 +01:00
Daniel García Aubert
37a61f527c Do not set language settings for travis 2018-10-31 18:57:25 +01:00
Daniel García Aubert
5e3d546fb6 Add package-lock.json and link to development dependencies 2018-10-31 18:52:40 +01:00
Daniel García Aubert
b7b5f031f3 Update docker test scripts to support Node.js 6 and 10 buildings 2018-10-31 17:20:25 +01:00
Daniel García Aubert
e57e548c31 Run docker test against Node.js 10 2018-10-31 14:47:32 +01:00
Javier Goizueta
b0d1d5a07a Fix test 2018-10-31 12:39:06 +01:00
Javier Goizueta
c63380427e Fix comment 2018-10-31 12:02:23 +01:00
Javier Goizueta
102e75ce95 Add test for hours time dimension
It tests the problem solved in #1054
2018-10-31 12:00:40 +01:00
Daniel G. Aubert
420c39337c Merge pull request #1052 from CartoDB/use-strict
Use strict mode
2018-10-26 11:21:37 +02:00
Javier Goizueta
214c796a4c Merge pull request #1054 from CartoDB/fix-time-dimension-iso-hours
Fix iso format for hours in time dimensions
2018-10-26 11:01:00 +02:00
Daniel García Aubert
8918d6bec0 Link dependencies to the released versions 2018-10-26 10:19:59 +02:00
Daniel García Aubert
ca7acb8339 Merge branch 'master' into use-strict 2018-10-25 11:11:30 +02:00
Daniel García Aubert
5083ccb605 Link development branches of related dependencies 2018-10-25 10:59:27 +02:00
Javier Goizueta
6908aa532c Fix iso format for hours in time dimensions
The HH specifies hour of day 01-12, we need HH24 for 00-23
2018-10-24 21:15:10 +02:00
Daniel García Aubert
a7daa077ac Update NEWS 2018-10-24 15:53:28 +02:00
Rafa de la Torre
9f0d4905b1 Merge pull request #1053 from CartoDB/fix-tests-undefined-server
Fix for non-deterministic test (undefined server)
2018-10-24 12:11:36 +02:00
Daniel García Aubert
89d10210be Fix undefined context error in test, it raised after forcing strict mode 2018-10-24 11:58:20 +02:00
Rafa de la Torre
545d387bb4 Fix for non-deterministic test (undefined server)
When running tests I got this error:

```
  1) multilayer error cases bogus sql raises 400 status code:
     TypeError: Cannot read property 'listen' of undefined
      at Function.assert.response (test/support/assert.js:93:26)
      at Function.requestLayergroup (test/acceptance/ported/support/test_client.js:79:20)
      at next (node_modules/step/lib/step.js:51:23)
      at Step (node_modules/step/lib/step.js:122:3)
      at Object.createLayergroup (test/acceptance/ported/support/test_client.js:75:5)
      at Context.<anonymous> (test/acceptance/ported/multilayer_error_cases.js:304:20)
```

The problem is that `server` is declared but its initialization
may depend on the order of execution of suites, which is basically
that of the filesystem/checkouts.

That is fixed by returning `getServer()`, which seems to be the
original intent: return a singleton of `CartodbServer` properly
initialized in case it is not overriden through options.
2018-10-23 18:55:31 +02:00
Daniel García Aubert
e2d27db828 Ise strict mode for moduler under test folder 2018-10-23 18:39:02 +02:00
Raul Ochoa
33bcac189f Merge pull request #1050 from CartoDB/prevent-layert-stats-undefined-access
Prevent "Cannot read property 'geom_type' of undefined" on layer stats
2018-10-23 18:37:00 +02:00
Daniel García Aubert
361e99006b Ignore line 2018-10-23 18:20:11 +02:00
Daniel García Aubert
7162ab1631 Add app.js to be linted 2018-10-23 18:19:55 +02:00
Daniel García Aubert
9374e0fe18 Add strict mode to main file (app.js) 2018-10-23 18:09:58 +02:00
Raul Ochoa
b13ae62d0f Do not assert the estimated count as it seems to change over pg versions 2018-10-23 16:02:37 +00:00
Raul Ochoa
49de289a9c Merge pull request #1051 from CartoDB/output-versions
Output PostgreSQL and PostGIS versions
2018-10-23 17:58:30 +02:00
Daniel García Aubert
b6dcf72268 Missing semicolon 2018-10-23 17:55:35 +02:00
Daniel García Aubert
76cfd185de Please jshint 2018-10-23 17:54:11 +02:00
Daniel García Aubert
79820a0f05 Add function as method of to be stric mode compilant 2018-10-23 17:52:19 +02:00
Daniel García Aubert
a0126f6a15 Use stric mode for resource-locator module 2018-10-23 17:48:53 +02:00
Raul Ochoa
abd378e5f6 Run tests based on PostGIS version 2018-10-23 15:47:48 +00:00
Daniel García Aubert
e7e3d612a1 Use strict mode in modules under lib folder (except lib/cartodb/models/resource-locator.js) 2018-10-23 17:45:42 +02:00
Raul Ochoa
208dbfd951 Output PostgreSQL and PostGIS versions 2018-10-23 14:34:17 +00:00
Raul Ochoa
26e4a05276 Going green: prevent TypeError for empty tables/results
This is the intial step to fix https://github.com/CartoDB/carto-vl/issues/1049.
2018-10-23 13:50:49 +00:00
Raul Ochoa
3e261fb353 Going red: fails with 400 due to "Cannot read property 'geom_type' of undefined" 2018-10-23 15:49:34 +02:00
Daniel G. Aubert
4775c73aee Merge pull request #1049 from CartoDB/upgrade-windshaft-4.11.4
Upgrade windshaft to version 4.11.4
2018-10-23 13:03:17 +02:00
Daniel García Aubert
1ece97d0a1 Update NEWS 2018-10-23 12:36:03 +02:00
Daniel García Aubert
87ef8d1977 Upgrade windshaft to version 4.11.4 2018-10-23 12:25:36 +02:00
Daniel G. Aubert
2ebb1728ee Merge pull request #1048 from CartoDB/fix-uncaught-error
Prevent from uncaught exception
2018-10-23 11:54:55 +02:00
Daniel García Aubert
621b11ebd6 Update NEWS 2018-10-23 10:05:53 +02:00
Daniel García Aubert
12d58f3af2 Prevent from uncaught exception: Range filter Error from camshaft when getting analysis query 2018-10-22 15:26:59 +02:00
Daniel G. Aubert
211e815d9c Merge pull request #1047 from CartoDB/upgrade-windshaft-4.11.3
Upgrade windshaft 4.11.3
2018-10-19 13:26:54 +02:00
Daniel García Aubert
465fd2ec0a Merge branch 'master' into upgrade-windshaft-4.11.3 2018-10-19 13:08:34 +02:00
Daniel García Aubert
d0c405ae46 Upgrade windshaft to version 4.11.3 2018-10-19 13:04:03 +02:00
Daniel G. Aubert
953d831d5f Merge pull request #1046 from CartoDB/fix-create-key
Do not use 'Object.assign' as '_.defautls' equivalent
2018-10-19 12:49:17 +02:00
Daniel García Aubert
5573db2bc1 Do not use Object.assign as _.defautls equivalent 2018-10-19 11:57:54 +02:00
Rafa de la Torre
195b23248b Merge pull request #1041 from CartoDB/config-postgis-for-mvts
Sample configs: use PostGIS to generate MVT's
2018-10-17 18:37:27 +02:00
Rafa de la Torre
83897293c6 Fix test by giving redis enough time to delete 2018-10-17 17:35:36 +02:00
Rafa de la Torre
f26ddef244 Make rate limit tests work in dual mode 2018-10-17 17:35:36 +02:00
Rafa de la Torre
d25e8e9798 Make the test work in dual mode (mapnik/pgis) 2018-10-17 17:35:36 +02:00
Rafa de la Torre
bfbd9a8f22 Fix another suite (compat mapnik/pgis) 2018-10-17 17:35:36 +02:00
Rafa de la Torre
bd17f9f5e1 A better implementation of mvt suites 2018-10-17 17:35:36 +02:00
Rafa de la Torre
8491b86c17 Extract test generation function 2018-10-17 17:35:36 +02:00
Rafa de la Torre
376a3743c1 Fix buffer size per format tests 2018-10-17 17:35:36 +02:00
Rafa de la Torre
a42af5e0d5 Do not run test if ST_AsMvt not avail. 2018-10-17 17:35:36 +02:00
Rafa de la Torre
e157649571 Use of postgis renderer based on availabilty 2018-10-17 17:35:36 +02:00
Rafa de la Torre
e50d1a10d0 Skip tests if they cannot be run
If configured with `mvt.usePostGIS` but with no postgis version
supporting it, they should be skipped.
2018-10-17 17:35:36 +02:00
Rafa de la Torre
d474d49ce8 Do not use point in world's border 2018-10-17 17:35:36 +02:00
Rafa de la Torre
4dba4ef641 Tweak the scale denominator for pg-mvt renderer
The scale denominator is calculated with float values and more
precision, resulting in different (but more accurate) values
2018-10-17 17:35:36 +02:00
Rafa de la Torre
be08fa3bfa Tweak id's to test against pg-mvt renderer
Actually, the ID's are not generated by ST_AsMVT. They appear as an
artifact of testing, when using toGeoJSONSync (implemented in mapnik).
2018-10-17 17:35:36 +02:00
Simon Martín
945b151712 using docker tag postgis-2.4.4.5 in travis 2018-10-17 17:35:36 +02:00
Simon Martín
2af6486f73 new docker tags 2018-10-17 17:35:36 +02:00
Rafa de la Torre
9cffc8781a Sample configs: use PostGIS to generate MVT's 2018-10-17 17:35:36 +02:00
Daniel García Aubert
b75c1f7f08 Update NEWS 2018-10-17 15:42:13 +02:00
Rafa de la Torre
c5d22bf9e3 Update package version 2018-10-17 15:29:07 +02:00
Rafa de la Torre
1baae5e709 Update dependencies (windshaft@4.11.2) 2018-10-17 15:28:56 +02:00
Rafa de la Torre
da3239cfa1 Merge pull request #1045 from CartoDB/update-windshaft-pg-mvt-trailing-semicolons
Update windshaft with a patch fo pg-mvt renderer
2018-10-17 15:25:27 +02:00
Rafa de la Torre
ba0078c51c Update windshaft with a patch fo pg-mvt renderer
Update windshaft to version 4.11.2, which contains a patch that makes
the pg-mvt renderer accept a trailing semicolon in the input query.
2018-10-17 15:12:33 +02:00
Daniel G. Aubert
47f64401a7 Merge pull request #1044 from CartoDB/upgrade-windshaft-4.11.1
Upgrade windshaft to version 4.11.1
2018-10-16 17:28:22 +02:00
Daniel García Aubert
8bdbe7c9b7 Update NEWS 2018-10-16 17:18:21 +02:00
Daniel García Aubert
0637018cca Upgrade windshaft to version 4.11.1 2018-10-16 17:16:57 +02:00
Daniel G. Aubert
8a7bef673b Merge pull request #1043 from CartoDB/mvt-query-rewrite
Use overviews query rewriter for mvt-renderer
2018-10-15 16:02:39 +02:00
Daniel García Aubert
a0e71ac396 Upgrade windshaft to version 4.11.0 2018-10-15 15:50:48 +02:00
Daniel García Aubert
184a804367 Improve assertions 2018-10-15 15:25:23 +02:00
Daniel García Aubert
c234b4ea91 Organize params 2018-10-15 08:30:51 +02:00
Daniel García Aubert
db13f5e4f3 ES6 tweaks 2018-10-15 08:25:44 +02:00
Daniel García Aubert
f9a8b3c827 Add acceptance test 2018-10-15 08:23:39 +02:00
Daniel García Aubert
17886d0e43 Revert "Use early return pattern"
This reverts commit 297e56f4e1.
2018-10-11 18:17:16 +02:00
Daniel García Aubert
1f112d587f Revert "Rename function"
This reverts commit 12dc1626a7.
2018-10-11 18:17:03 +02:00
Daniel García Aubert
5c56ea6b22 Add test to validate that Postgis and Mapnik renderers are using overviews tables 2018-10-11 17:59:49 +02:00
Daniel García Aubert
3c76dfbbb3 Use devel branch of windshaft 2018-10-11 15:41:58 +02:00
Daniel García Aubert
e158e3e426 Pass overview-query-rewriter to mvt renderer 2018-10-11 15:41:38 +02:00
Daniel García Aubert
12dc1626a7 Rename function 2018-10-10 15:07:47 +02:00
Daniel García Aubert
297e56f4e1 Use early return pattern 2018-10-10 15:06:56 +02:00
Javier Goizueta
09f75441ba Merge pull request #1039 from CartoDB/time-dimensions
Time dimensions
2018-10-09 16:06:06 +02:00
Javier Goizueta
41bd69d050 Remove public docs for the time being
We might want to make changes to the API after initial test usage
2018-10-09 15:17:29 +02:00
Javier Goizueta
73b3402d85 Refactor stats collection 2018-10-09 13:24:08 +02:00
Javier Goizueta
d66a304b00 Merge branch 'master' into time-dimensions
# Conflicts:
#	NEWS.md
2018-10-08 19:35:38 +02:00
Javier Goizueta
ee63b247cd Slight refactor 2018-10-08 19:25:04 +02:00
Javier Goizueta
418e0e2aa3 Documentation corrections 2018-10-08 19:16:50 +02:00
Javier Goizueta
d4bd706fe2 Clarify some tests 2018-10-08 19:16:32 +02:00
Javier Goizueta
a4dfc09c71 Aggregation dimensions documentation 2018-10-07 23:12:41 +02:00
Javier Goizueta
9ed39f149b Time dimension tests 2018-10-07 22:46:02 +02:00
Javier Goizueta
0e85aa56da Fix test 2018-10-07 11:35:28 +02:00
Javier Goizueta
2f59919f84 Dimension metadata test 2018-10-07 00:29:12 +02:00
Javier Goizueta
10baf43ede Fix dimension metadata bug 2018-10-07 00:28:53 +02:00
Javier Goizueta
996d7fc90d Lint fixes 2018-10-06 18:26:43 +02:00
Javier Goizueta
c0febf2fd1 Rename time dimension parameters 2018-10-05 20:08:40 +02:00
Javier Goizueta
f841f65a1e Dimensions metadata 2018-10-04 19:50:14 +02:00
Javier Goizueta
c9786ee3f6 Catch aggregation query errors 2018-10-03 23:13:22 +02:00
Javier Goizueta
99b62edcbd Bug fixes 2018-10-03 23:12:58 +02:00
Javier Goizueta
c588d4139e Refactor time dimensions 2018-10-03 21:02:22 +02:00
Javier Goizueta
aff55351ad Unify parameter names 2018-10-03 19:07:47 +02:00
Javier Goizueta
96ba075698 Unify handling of cyclic time groupings
Remove generic cyclic grouping
2018-10-03 18:57:00 +02:00
Javier Goizueta
a7d5415f64 Remove offsets from time dimension computations 2018-10-03 17:12:01 +02:00
Javier Goizueta
dede22c915 Changes in time dimensions API
Use single `starting` epoch instead of various offsets.
Add ISO text representation.
Adopt ISO conventions for day of week and week of year.
Rename internal parameters for consistency with external API.
2018-10-03 17:05:58 +02:00
Javier Goizueta
fbf3fd9d8c Support old and new dimension definitions 2018-09-25 19:10:56 +02:00
Simon Martín
e70de80cdf Stub next version 2018-09-24 11:35:10 +02:00
Simon Martín
ef9ec5b262 Merge pull request #1032 from CartoDB/windshaft-remove-step
upgrades Windshaft (remove step)
2018-09-24 11:29:48 +02:00
Simon Martín
f9b8152f21 Merge branch 'master' into windshaft-remove-step 2018-09-24 11:16:45 +02:00
Simon Martín
e0ff8b4320 NEWS/package to version 6.4.0 and release date 2018-09-24 11:14:41 +02:00
Simon Martín
6a699ba51b windshaft version 4.10.0 2018-09-24 11:03:24 +02:00
Javier Goizueta
fbcfc7a582 WIP: time dimensions for aggregation 2018-09-20 21:12:54 +02:00
Simon Martín
1899fd3813 updating to lastest windshaft version 2018-09-20 17:41:44 +02:00
Javier Goizueta
bd7c99f94f Merge pull request #1036 from CartoDB/1034-aggregation-bbox
Aggregation limits adjustment fix
2018-09-17 17:05:31 +02:00
Javier Goizueta
6ba9e50da7 Minor tests refactor 2018-09-13 08:54:59 +02:00
Javier Goizueta
21a2d9e82f Merge pull request #1035 from CartoDB/1033-no-the_geom
Avoid requiring the_geom for point-sample aggregation
2018-09-13 08:51:34 +02:00
Javier Goizueta
0f20cdaae1 More robust adjustment of spatial limits to the aggregation grid
See #1034
2018-09-12 19:27:21 +02:00
Javier Goizueta
5d813b6e43 Add more tests for aggregation accuracy
Some tests are skipped for Mapnik MVTs, because its bbox filtering isn't accurate
2018-09-12 19:26:09 +02:00
Raúl Marín
a842acfdb4 Merge pull request #1029 from Algunenano/update_640_vars
Update next release version according to the changes done
2018-09-12 19:09:13 +02:00
Javier Goizueta
1e65804a1b Avoid requiring the_geom for point-sample aggregation 2018-09-12 11:26:14 +02:00
Javier Goizueta
acf0b082b4 Perform some tests for all placements
The "only the_geom" and other aggregation tests were perform only for default aggregation.
2018-09-12 11:25:21 +02:00
Simon Martín
2c6305bcd4 windshaft version: remove-step 2018-09-07 12:23:09 +02:00
Raul Marin
bd153a0c87 Update next release version according to the changes done 2018-09-05 16:07:43 +02:00
Raúl Marín
fb6987e91a Merge pull request #1027 from CartoDB/carto_mvt_extent
Update Windshaft to 4.9.0
2018-09-05 13:30:12 +02:00
Eneko Lakasta
74c036483a Merge pull request #1028 from CartoDB/1024-log-overviews-mapconfig
use as flag overviewsAddedToMapconfig instead of overviewsUsed
2018-09-05 13:24:48 +02:00
Eneko Lakasta
65e10bc20d use as flag overviewsAddedToMapconfig instead of overviewsUsed 2018-09-05 13:14:55 +02:00
Eneko Lakasta
89a1e69bec Merge pull request #1026 from CartoDB/1024-log-overviews-mapconfig
Log overviews usage during map instantiation
2018-09-05 12:52:22 +02:00
Eneko Lakasta
564884797d add tests to check that flags for non overviews instantiation are correct 2018-09-05 12:39:51 +02:00
Eneko Lakasta
dd1ee56648 use .some instead of .map & .some 2018-09-05 11:56:45 +02:00
Eneko Lakasta
c54c3754ef fix indentation 2018-09-05 11:51:58 +02:00
Eneko Lakasta
d72a5075b9 move overviews flags in named map instantiation checks to its own specific tests 2018-09-05 11:48:21 +02:00
Eneko Lakasta
6dde5fc6f1 use .some instead of reduce 2018-09-04 18:22:48 +02:00
Eneko Lakasta
880ef63720 add to logs named maps overviews instantiation 2018-09-04 16:21:20 +02:00
Eneko Lakasta
b75150e91e set mapType in the controller instead of in the adapter 2018-09-04 16:20:38 +02:00
Eneko Lakasta
006e21379f please jshint line to long 2018-09-04 15:30:20 +02:00
Eneko Lakasta
03850fb31c Merge branch 'master' into 1024-log-overviews-mapconfig 2018-09-04 15:14:21 +02:00
Eneko Lakasta
7df0fb456b add to log anonymous maps instantiations that use overviews tables
Added to tiler profiler object:

overviewsAddedToMapconfig: true
mapType: 'anonymous'
2018-09-04 15:13:17 +02:00
Eneko Lakasta
1fe1b5fc4d Merge pull request #1024 from CartoDB/5201-log-overviews
Log overviews usage
2018-08-30 16:11:36 +02:00
Eneko Lakasta
95d179835c add to logs even if no overviews tables were used.
{usesOverviews:false}
2018-08-30 14:52:37 +02:00
Eneko Lakasta
7c52f504e5 add dataview type to overviews logs 2018-08-30 14:30:03 +02:00
Raul Marin
44bbfe3ba6 Update Windshaft to 4.9.0 2018-08-30 07:01:34 +02:00
Raul Marin
57258a9cd3 MVT (pg-mvt): Remove tests related to removed functionality 2018-09-03 14:59:20 +02:00
Raul Marin
cd25150056 MVT: Removed error parsing for empty tiles 2018-09-03 14:59:16 +02:00
Eneko Lakasta
c9d50c412d add tests for dataviews 2018-08-29 18:00:13 +02:00
Eneko Lakasta
732f891850 refactor in order not to tamper the dataview results data 2018-08-29 15:06:48 +02:00
Eneko Lakasta
8ef260972d add to log when overviews are being used in dataviews 2018-08-29 13:50:21 +02:00
Daniel G. Aubert
bdd1481024 Merge pull request #1023 from CartoDB/975-document-named-and-static-maps
Document named and static maps
2018-08-28 11:02:55 +02:00
Daniel García Aubert
810ad46446 Simplify schemas 2018-08-28 09:38:59 +02:00
Daniel García Aubert
94cd3d008c Add placeholder default value 2018-08-28 09:37:16 +02:00
Daniel García Aubert
2ec0b4674c Add 429 too many request error 2018-08-27 17:49:38 +02:00
Daniel García Aubert
5b30c390fd Add 500 server internal error 2018-08-27 17:25:52 +02:00
Daniel García Aubert
9de9c57dc2 Remove meaningless sentence 2018-08-27 11:55:52 +02:00
Daniel García Aubert
02dc61b7c7 Add Bad Request 2018-08-24 18:04:16 +02:00
Daniel García Aubert
7822f59fd4 Typo 2018-08-24 17:40:04 +02:00
Daniel García Aubert
158f2159b7 Add layer query params 2018-08-24 17:37:46 +02:00
Daniel García Aubert
44c4b29ea2 Adding curl example 2018-08-24 15:11:08 +02:00
Daniel García Aubert
7c13561a4f Add jsonp named map instantiation endpoint 2018-08-24 13:28:53 +02:00
Simon Martín
de30ab99ef Merge pull request #1021 from CartoDB/naming-fixes
Requirements version changes
2018-08-24 12:53:49 +02:00
Daniel García Aubert
380dab1461 Add title to components 2018-08-24 12:46:00 +02:00
Simon Martín
de6c651b60 Merge branch 'master' into naming-fixes 2018-08-24 12:24:52 +02:00
Daniel García Aubert
91002933e3 Add more endpoints 2018-08-24 11:42:46 +02:00
Daniel García Aubert
cd75581ccb Add list template endpoint 2018-08-24 10:42:08 +02:00
Daniel García Aubert
49d5f560a7 Extract components 2018-08-23 19:07:13 +02:00
Daniel García Aubert
409170f661 Create TemplatePlaceholders 2018-08-23 18:24:17 +02:00
Daniel García Aubert
e3f6d4e9fd Fix swagger errors 2018-08-23 17:19:45 +02:00
Daniel García Aubert
346189cf4c Draft 2018-08-23 16:50:47 +02:00
Javier Goizueta
b466937d68 Merge pull request #1022 from CartoDB/stats-spaces
Fix column stats to support spaces in names
2018-08-21 16:24:41 +02:00
Javier Goizueta
d338b5ca37 Fix column stats to support spaces in names
This complements changes in #1020
2018-08-21 12:55:30 +02:00
Javier Goizueta
9740b65fe7 Update NEWS 2018-08-20 18:34:29 +02:00
Jesús Arroyo Torrens
27e2d0baa5 Merge pull request #1020 from CartoDB/spaces-in-columns
Fix spaces in columns
2018-08-20 17:56:48 +02:00
Alejandro Guirao Rodríguez
4039221b4b Update carto-package.json 2018-08-17 10:42:56 +02:00
Alejandro Guirao Rodríguez
5bb58429b3 Requirements version changes 2018-08-17 10:34:25 +02:00
Simon Martín
204d246a8c mapnik to requires in carto-package 2018-08-16 16:17:01 +02:00
Jesús Arroyo Torrens
e0f49ca8f5 Fix aggregation-query dimension functions regarding to spaces in columns 2018-08-16 15:34:06 +02:00
Simon Martín
07cdb37deb Merge pull request #1019 from CartoDB/create-carto-package-json
create carto-package.json file
2018-08-16 15:03:21 +02:00
cillas
2764eb9669 Delete old reference markdown 2018-08-16 15:00:49 +02:00
Simon Martín
5c3182e168 adding carto_postgresql_ext to carto-package 2018-08-16 14:44:43 +02:00
cillas
338ff63153 Add swagger.yaml 2018-08-16 14:22:18 +02:00
Jesús Arroyo Torrens
31263b7b22 Add unit test 2018-08-16 14:15:28 +02:00
Jesús Arroyo Torrens
925328c43b Fix bug in date-wrapper regarding to columns with spaces 2018-08-16 13:38:26 +02:00
Simon Martín
a36b93a473 mapnik 3.0.15 and removing gdal 2018-08-16 12:34:22 +02:00
Jesús Arroyo Torrens
14cf3c1093 Fix typo 2018-08-16 12:16:20 +02:00
Simon Martín
534808038e more versions 2018-08-14 18:29:42 +02:00
Simon Martín
83c7d38d42 adding versions, not finished 2018-08-14 14:36:49 +02:00
Simon Martín
964bfef6e7 create carto-package.json file 2018-08-14 12:26:33 +02:00
Juan Ignacio Sánchez Lara
657fb97d58 Merge pull request #1018 from CartoDB/camshaft_0_62_3
Camshaft 0.62.3
2018-08-03 12:56:22 +02:00
Juan Ignacio Sánchez Lara
2b36e8c68b Camshaft 0.62.3 2018-08-03 12:42:42 +02:00
Daniel G. Aubert
ed101e30fa Merge pull request #1015 from CartoDB/upgrade-camshaft-to-avoid-missing-columns
Upgrade camshaft to avoid missing columns when an analysis changes
2018-08-02 16:58:13 +02:00
Daniel García Aubert
9a3bd51664 Merge branch 'master' into upgrade-camshaft-to-avoid-missing-columns 2018-08-02 16:42:09 +02:00
Daniel G. Aubert
6576fa5ca0 Merge pull request #1017 from CartoDB/remove-step-globally
Move step as development dependency
2018-08-02 16:40:49 +02:00
Daniel García Aubert
45fc2dd07a Add empty line 2018-08-02 16:19:12 +02:00
Daniel García Aubert
e7a6ddb4ff Update NEWS 2018-08-02 16:15:10 +02:00
Daniel García Aubert
f719813c52 Update NEWS 2018-08-02 16:09:39 +02:00
Daniel García Aubert
9c4adef0c2 Update camshaft to a released version 2018-08-02 15:57:39 +02:00
Daniel García Aubert
9f831b2c40 Move step as development dependency 2018-08-02 15:14:10 +02:00
Daniel G. Aubert
dfa057d979 Merge pull request #1016 from CartoDB/remove-step-template-maps
Remove step template maps
2018-08-02 15:02:59 +02:00
Daniel G. Aubert
7ffac651b6 Merge pull request #1014 from CartoDB/remove-step-mapconfig-overviews-adapter
Remove step mapconfig overviews adapter
2018-08-02 14:54:38 +02:00
Daniel García Aubert
98ab237bf7 Merge branch 'master' into remove-step-template-maps 2018-08-02 14:10:26 +02:00
Daniel García Aubert
63e4bcebef Move function to class as private method 2018-08-02 13:13:48 +02:00
Daniel García Aubert
593a72a967 Reorganize code, estract methods and rename others 2018-08-02 11:40:41 +02:00
Simon Martín
6c8f38a241 improve var naming 2018-08-02 11:38:54 +02:00
Simon Martín
a910f1442e explicit error return 2018-08-02 11:35:54 +02:00
Daniel García Aubert
df14afb55f Remove unnecessary code 2018-08-01 19:15:28 +02:00
Daniel García Aubert
732a2d7742 Early return is the way to go. Avoid checking conditions later 2018-08-01 17:39:08 +02:00
Daniel García Aubert
78f4cf3155 Move code 2018-08-01 17:33:20 +02:00
Daniel García Aubert
8f763d655d Do not rename output values 2018-08-01 17:23:40 +02:00
Daniel García Aubert
64329c3fac Rename callback 2018-08-01 16:39:15 +02:00
Daniel García Aubert
c8c22a787e CamelCase 2018-08-01 16:35:19 +02:00
Daniel García Aubert
6a6ec4300b Extract functions to compose query-rewrite-data 2018-08-01 16:30:59 +02:00
Simon Martín
44ba5aa568 forgotten return 2018-08-01 16:22:43 +02:00
Simon Martín
01658c33fd remove step and assert dependencies 2018-08-01 16:03:36 +02:00
Simon Martín
efafd4cb3e success callback without err 2018-08-01 16:02:53 +02:00
Daniel García Aubert
d25740ed51 Extract function to avoid dynamic clousures 2018-08-01 16:02:05 +02:00
Simon Martín
3bb4ad86ff remove template 5 refactor 2018-08-01 16:00:31 +02:00
Simon Martín
b169c96f1c remove step 5 2018-08-01 15:57:22 +02:00
Daniel García Aubert
843f4b8e28 Use early return 2018-08-01 15:53:43 +02:00
Simon Martín
e5b75abc76 some details 2018-08-01 15:53:41 +02:00
Daniel García Aubert
83777540d0 Merge branch 'master' into remove-step-mapconfig-overviews-adapter 2018-08-01 15:51:43 +02:00
Simon Martín
0e28348e16 manage JSON parse and stringify sinc errors 2018-08-01 15:48:24 +02:00
Simon Martín
7b7bee2901 improve naming 2018-08-01 15:43:45 +02:00
Simon Martín
2a2f703abc style details 2018-08-01 15:40:40 +02:00
Simon Martín
e85f4e4129 selft to this 2018-08-01 15:39:25 +02:00
Simon Martín
bcad6dbe22 anage errors 2018-08-01 15:32:44 +02:00
Simon Martín
e9f88a78d5 remove step 4 2018-08-01 15:28:15 +02:00
Daniel G. Aubert
f601ed3806 Merge pull request #1012 from CartoDB/remove-step-filter-stats
Remove step filter stats
2018-08-01 14:59:36 +02:00
Simon Martín
085d26f1b2 remove step 3: refactor 2018-08-01 13:27:07 +02:00
Daniel García Aubert
559546d333 Merge branch 'master' into remove-step-filter-stats 2018-08-01 13:22:57 +02:00
Simon Martín
da8d92b78e remove step 3 2018-08-01 13:20:10 +02:00
Daniel G. Aubert
de5498c1b2 Merge pull request #1013 from CartoDB/remove-step-user-limits
Remove step user limits
2018-08-01 13:19:49 +02:00
Simon Martín
2134bf898a check user template limit in the right way 2018-08-01 13:13:25 +02:00
Daniel García Aubert
e27ed7e79d Merge branch 'master' into remove-step-user-limits 2018-08-01 12:46:47 +02:00
Daniel G. Aubert
efad5b20e8 Merge pull request #1011 from CartoDB/remove-step-dataviews
Remove step dataviews
2018-08-01 12:45:01 +02:00
Simon Martín
f27d5ba7d1 unneeded check 2018-08-01 12:40:22 +02:00
Simon Martín
09a67871fb manage JSON.stringify sync error 2018-08-01 12:38:50 +02:00
Simon Martín
cec9994add style details 2018-08-01 12:33:59 +02:00
Simon Martín
d45d0018d2 self to this 2018-08-01 12:32:20 +02:00
Simon Martín
410cbd082c manage errors 2018-08-01 12:26:40 +02:00
Simon Martín
fd875c41c7 remove step 2 2018-08-01 12:20:01 +02:00
Simon Martín
750798d0a3 ensuring redis_pool connection release 2018-08-01 12:10:09 +02:00
Simon Martín
04faaea10d remove unneded check 2018-08-01 11:49:40 +02:00
Simon Martín
74831c9b7f using ... operator instead of apply 2018-08-01 11:48:12 +02:00
Simon Martín
5471a218eb return errors 2018-08-01 11:39:07 +02:00
Simon Martín
79f2a8dde9 vars refactor: that to this, ... 2018-08-01 11:30:17 +02:00
Simon Martín
5c0b7487f7 using calbacks instead of step 2018-08-01 11:25:55 +02:00
Daniel García Aubert
c021f5ebdc Upgrade camshaft to avoid missing columns when an analysis changes its schema output 2018-07-31 19:15:08 +02:00
Daniel García Aubert
3a3baf3c85 Rename variable 2018-07-31 15:41:29 +02:00
Simon Martín
b8d320c434 return callback 2018-07-31 15:19:41 +02:00
Simon Martín
515e482886 early return 2018-07-31 15:07:34 +02:00
Simon Martín
ea0805b017 early return 2018-07-31 15:01:22 +02:00
Daniel García Aubert
ec0e90e8ce Avoid uncaught exceptions 2018-07-31 13:33:33 +02:00
Daniel García Aubert
d4de54f292 Extract get query with filters 2018-07-31 13:26:38 +02:00
Daniel García Aubert
9124a26a45 Move veriable declaration 2018-07-31 12:47:03 +02:00
Daniel García Aubert
18603ad24f Reduce cyclomatic complexity 2018-07-31 12:43:54 +02:00
Daniel García Aubert
70ac0587db Missing error 2018-07-31 12:15:20 +02:00
Daniel García Aubert
230b1bb3db Remove step .searchDataview() 2018-07-31 11:59:39 +02:00
Simon Martín
23ef884e9b remove step 1 2018-07-31 10:26:46 +02:00
Simon Martín
bb24b1dfcc indentation 2018-07-31 10:25:56 +02:00
Simon Martín
324e614902 change _.extend by Object.assign 2018-07-30 18:25:26 +02:00
Simon Martín
20c8d07a46 remove step: last function 2018-07-30 17:59:06 +02:00
Simon Martín
fe9f4939d5 remove step: function 2 2018-07-30 17:49:20 +02:00
Simon Martín
a89131c043 remove step: function 1 2018-07-30 17:34:14 +02:00
Simon Martín
1f6bb6839a remove step 2018-07-30 17:32:57 +02:00
Simon Martín
1e70717554 indentation 2018-07-30 17:31:42 +02:00
Simon Martín
3cf378e045 remove 'self' 2018-07-30 17:21:19 +02:00
Simon Martín
12ad4420aa remove step: function 2 refactor 2018-07-30 17:18:35 +02:00
Simon Martín
70000f9df1 remove step: function 2 2018-07-30 17:16:27 +02:00
Simon Martín
eaff11ef6e remove step: function 1 2018-07-30 17:15:04 +02:00
Simon Martín
6c3b546648 remove step 2018-07-30 17:09:34 +02:00
Simon Martín
384f4f74e0 remove 'self' with arrows functions 2018-07-30 16:44:30 +02:00
Simon Martín
898bac5b04 jshint and style 2018-07-30 16:42:17 +02:00
Simon Martín
cd08ad693f remove step: last function refactor 2018-07-30 16:38:04 +02:00
Simon Martín
c2577d1d25 remove step: last function 2018-07-30 16:02:04 +02:00
Daniel García Aubert
13075460ac Do not override incoming arguments 2018-07-30 16:00:30 +02:00
Daniel García Aubert
cca0848e6d Improve error 2018-07-30 15:59:43 +02:00
Simon Martín
150658d58d remove step: 3 function refactor 2018-07-30 15:59:37 +02:00
Daniel García Aubert
6be1a77a29 Use callback to return the error 2018-07-30 15:57:47 +02:00
Simon Martín
fb683e438d remove step: second function 2018-07-30 15:56:18 +02:00
Simon Martín
2196a89ec3 remove step: 2 function refactor 2018-07-30 15:55:24 +02:00
Simon Martín
bafeceeb6e remove step: first funcion 2018-07-30 15:54:26 +02:00
Simon Martín
eeafad7cd9 remove step 2018-07-30 15:52:41 +02:00
Daniel García Aubert
94b7353fbf Fix uncaught exception 2018-07-30 15:52:04 +02:00
Simon Martín
60cd91f144 indentation 2018-07-30 15:50:41 +02:00
Daniel García Aubert
1d199f8713 Remove step in method 2018-07-30 15:19:53 +02:00
Daniel García Aubert
42b79e5bc6 Stubs next version 2018-07-26 10:37:12 +02:00
Daniel García Aubert
7f12cb3fdc Release 6.3.0 2018-07-26 10:19:24 +02:00
Daniel G. Aubert
6cad1a3ead Merge pull request #1009 from CartoDB/camshaft_0_62_1
Camshaft 0.62.1
2018-07-25 19:36:32 +02:00
Juan Ignacio Sánchez Lara
9d5fa55d5c Camshaft 0.62.1 2018-07-25 19:25:24 +02:00
Juan Ignacio Sánchez Lara
4f910e942f Merge pull request #1007 from CartoDB/camshaft_0_62_0
Camshaft 0.62.0
2018-07-25 14:26:10 +02:00
Juan Ignacio Sánchez Lara
c43e5827c8 Merge branch 'master' into camshaft_0_62_0 2018-07-25 11:01:25 +02:00
Daniel García Aubert
58b6702071 Stubs next version 2018-07-20 13:32:55 +02:00
Daniel García Aubert
a6dd3d8354 Release 6.2.0 2018-07-20 13:30:34 +02:00
Javier Goizueta
028d17f149 Merge pull request #1008 from CartoDB/windshaft-4.8.3
Upgrade Windshaft to 4.8.3
2018-07-19 16:08:19 +02:00
Javier Goizueta
1cba4a1a9b Update NEWS for windshaft 4.8.3 2018-07-19 13:04:27 +02:00
Javier Goizueta
7243e4a0e2 Upgrade Windshaft to 4.8.3
This fixes problem of very slow instantiantion of large tables with aggregations
2018-07-19 12:30:10 +02:00
Juan Ignacio Sánchez Lara
760b00b85f Camshaft 0.62.0 2018-07-19 12:20:33 +02:00
Juan Ignacio Sánchez Lara
fc6760717b Camshaft 0.62.0 2018-07-19 11:09:19 +02:00
Juan Ignacio Sánchez Lara
83c417ed2e Camshaft 0.62.0 2018-07-19 10:17:14 +02:00
Javier Goizueta
fcfa763890 Merge pull request #1002 from CartoDB/aggregation-fixes
Aggregation fixes
2018-07-18 11:54:13 +02:00
Raúl Marín
942b7ef923 Merge pull request #1005 from Algunenano/master_union_all
Tests: Use "UNION ALL" instead of "UNION" to improve performance
2018-07-18 10:49:05 +02:00
Daniel G. Aubert
bc61f79b3a Merge pull request #1006 from CartoDB/upgrade-windshaft-4.8.2
Upgrade windshaft@4.8.2
2018-07-17 18:01:51 +02:00
Daniel García Aubert
d649d7eb1d Update NEWS 2018-07-17 17:49:58 +02:00
Daniel García Aubert
cf20728711 Upgrade winshaft@4.8.2 2018-07-17 17:34:41 +02:00
Raul Marin
cd31f998dd Tests: Use "UNION ALL" instead of "UNION" to improve performance 2018-07-17 12:43:50 +02:00
Javier Goizueta
51c3215137 Change UNION by UNION ALL in tests
It seems UNION (without ALL) can be much slower in recent PG versions
2018-07-17 12:42:33 +02:00
Daniel G. Aubert
3e0cb0ed37 Merge pull request #997 from CartoDB/last-modified-always
Remove parameter `now` for last-modified-header middleware
2018-07-17 11:32:37 +02:00
Eneko Lakasta
7d5469ed1c Merge pull request #1003 from CartoDB/add-create-layergroup-stats
Add create layergroup stats
2018-07-16 17:54:18 +02:00
Eneko Lakasta
d6b081255c Merge pull request #1004 from CartoDB/upgrade-turbo-carto
Upgrade turbo carto
2018-07-16 17:54:05 +02:00
Daniel García Aubert
f9b59d8549 Do not override stats 2018-07-16 17:18:58 +02:00
Eneko Lakasta
1534c26050 update NEWS with new version of turbo carto 2018-07-16 17:07:53 +02:00
Daniel García Aubert
81eb849aff Add stats first 2018-07-16 16:58:53 +02:00
Eneko Lakasta
f72ec17c5f upgrade turbo carto to 0.20.4 2018-07-16 16:57:41 +02:00
Daniel García Aubert
9f9b933607 Add create layergroup stats 2018-07-16 16:52:26 +02:00
Javier Goizueta
e5d4369203 Fix test 2018-07-16 14:59:26 +02:00
Javier Goizueta
e1ec38446d Add aggregation test with buffer overlapping cells partially
Also fix resolution parameter incrrectly placed in some tests
2018-07-16 14:27:39 +02:00
Javier Goizueta
2d102c4810 Compensate for bbox lack of accuracy 2018-07-16 12:44:30 +02:00
Javier Goizueta
e59d0f520a Restore tests 2018-07-16 12:02:37 +02:00
Javier Goizueta
2063ac15ee Fix long lines 2018-07-16 11:58:56 +02:00
Javier Goizueta
7b597e0223 Update NEWS 2018-07-15 22:27:49 +02:00
Javier Goizueta
716f983e71 Filter out partially aggregated clusters
Fixes #889
2018-07-15 22:26:37 +02:00
Javier Goizueta
31feb58e1f Compute aggregation cell size accurately
This fixes #1001
2018-07-15 22:25:16 +02:00
Javier Goizueta
92ef0a60fc Test aggregation accuracy
This tests #1001
2018-07-15 22:17:00 +02:00
Javier Goizueta
e21ab12e4c Test that tiles do not contain partially aggregated clusters
This tests #889
2018-07-15 22:15:57 +02:00
Javier Goizueta
b5a0c6505a Merge pull request #998 from CartoDB/994-aggr-tests
Adapt tests for more accurate PROJ
2018-07-11 17:23:02 +02:00
Javier Goizueta
dfb4e20219 Merge pull request #999 from Algunenano/test_fixes
Multiple test fixes
2018-07-11 17:22:50 +02:00
Javier Goizueta
9cbcd43fda Fix another test 2018-07-11 16:56:37 +02:00
Javier Goizueta
7cadbcc533 Fix tests, this time for good :fingers_crossed: 2018-07-11 16:47:10 +02:00
Javier Goizueta
d3a3a7353a Fix tests
They were not numerical accuracy independent, as intended
2018-07-11 16:34:39 +02:00
Javier Goizueta
b8365e9f6e Make sampling tests more stable
Some sample tests, which cannot use RNG seeding, are nondeterministical.
Increment size of test table used in sampling tests to make less likely that the sample is empty
2018-07-11 15:21:23 +02:00
Javier Goizueta
e17dd4b5fa Make tests independent of coordinate accuracy by not placing points near tile boundaries 2018-07-11 13:19:07 +02:00
Raul Marin
8dcab568bd Tests: Adapt torque tests to work with PROJ 5.1 2018-07-11 12:33:02 +02:00
Raul Marin
a0020804c9 Test (regressions.js): Remove all redis keys so tests can be run individually 2018-07-11 12:21:06 +02:00
Raul Marin
ea2126a301 Tests: Fix DB flags being ignored 2018-07-11 12:20:58 +02:00
Javier Goizueta
8442a9a711 Shorten long lines 2018-07-11 11:29:22 +02:00
Javier Goizueta
c07b3de43d Adapt tests for more accurate PROJ
Fixes #994
With exact point 0,0 transformations, the point is between tiles and can appear in several
2018-07-11 10:33:58 +02:00
Daniel García Aubert
4f81f402f5 Remove parameter now for last-modified-header 2018-07-10 13:22:38 +02:00
Eneko Lakasta
10d21a4a0f Merge pull request #996 from CartoDB/upgrade-yarn-lock-turbo-carto
upgrade turbo-carto 0.20.3 in yarn.lock
2018-07-09 17:41:07 +02:00
Eneko Lakasta
42bcae0e4a upgrade turbo-carto 0.20.3 2018-07-09 16:58:50 +02:00
Eneko Lakasta
04c5b2aa36 Merge pull request #995 from CartoDB/14075-2buckets-bubble-legends
Use new version of turbo-carto 0.20.3
2018-07-09 16:23:35 +02:00
Eneko Lakasta
b30f7264f1 upgrade package.json turbo-carto to 0.20.3 2018-07-09 16:01:51 +02:00
Eneko Lakasta
2800a50f19 upgrade package.json turbo-carto to 0.2.30 2018-07-09 15:53:16 +02:00
Simon Martín
287ecf5ce2 Updating NEWS 2018-07-06 11:44:37 +02:00
Simon Martín
53b7969753 Merge pull request #989 from CartoDB/fix-rate-limit-endpoint-several-limits
Upgrading cartodb-redis
2018-07-06 11:41:14 +02:00
Simon Martín
9530f17194 Merge branch 'master' into fix-rate-limit-endpoint-several-limits 2018-07-06 11:06:23 +02:00
Rafa de la Torre
0829d5bc7d Merge pull request #991 from CartoDB/fix-numeric-histogram-bounds
Fix numeric histogram bounds
2018-07-05 18:12:19 +02:00
Rafa de la Torre
b59712ee10 Update NEWS.md with reference to fix 2018-07-05 17:24:29 +02:00
Rafa de la Torre
e247e45f96 Qualify columns and improve if/else style
As suggested by Algunenano: qualify column names with the
table/subquery/cte to avoid name clashing, and polish the code style a
little.
2018-07-05 17:21:38 +02:00
Simon Martín
df71d93dd9 upgrading cartodb-redis to 2.0.1 2018-07-05 15:16:45 +02:00
Simon Martín
928f10b420 updating version cartodb-redis (still using github) 2018-07-05 12:39:28 +02:00
Rafa de la Torre
a1807fd0c3 A better solution to the start-end problem 2018-07-05 12:39:26 +02:00
Rafa de la Torre
d937ce4982 Fix the min >= start and max <= end case (WIP)
This fixes the 'should get bins with min >= start and max <= end' test
case but probably breaks a number of other cases (those with no start
and/or no end).
2018-07-05 11:56:26 +02:00
Rafa de la Torre
6411556a97 Test for histogram bins beyond limits 2018-07-04 18:33:02 +02:00
Rafa de la Torre
2c334570c3 run_tests.sh is a *bash* script 2018-07-04 17:39:13 +02:00
Eneko Lakasta
c1671abaa4 Merge pull request #988 from CartoDB/984-sql-timeout-error-message
984 limits error messages
2018-07-03 16:44:58 +02:00
Eneko Lakasta
d82cc98b75 update package.json to use turbo-carto git branch 2018-07-03 16:20:42 +02:00
Eneko Lakasta
5d7af03228 remove .only from test 2018-07-03 16:20:09 +02:00
Eneko Lakasta
529368e858 Merge branch '984-sql-timeout-error-message' into 14075-2buckets-bubble-legends 2018-07-03 15:58:10 +02:00
Eneko Lakasta
fdc061b7ee Please jshint 2018-07-03 15:02:58 +02:00
Eneko Lakasta
923b23871f Please jshint 2018-07-03 14:48:54 +02:00
Eneko Lakasta
409a103990 update rate limit error message 2018-07-03 14:36:29 +02:00
Eneko Lakasta
6a6815d893 update render limits error message 2018-07-03 14:32:10 +02:00
Eneko Lakasta
37737e7941 Merge branch '984-sql-timeout-error-message' into 14075-2buckets-bubble-legends 2018-07-03 12:45:41 +02:00
Simon Martín
af0bc09d52 updating to temporal branch of cartodb-redis 2018-07-03 11:57:02 +02:00
Eneko Lakasta
a8d791e2d3 update tests with new error message 2018-07-02 13:03:01 +02:00
Eneko Lakasta
c874a734fd fix db limit error message set order 2018-07-02 13:02:36 +02:00
Eneko Lakasta
23e5cefdf1 Update NEWS 2018-07-02 11:29:47 +02:00
Eneko Lakasta
9226b67ab7 add tests 2018-06-29 15:03:45 +02:00
Eneko Lakasta
ee25585f06 add new error message 2018-06-29 15:01:12 +02:00
Simon Martín
028c3f9aec Merge pull request #987 from CartoDB/ignore-null-values-formula-dataview
ensuring formula dataview filters infinities, nans and nulls
2018-06-28 13:12:42 +02:00
Simon Martín
cc048c41d8 Merge branch 'master' into ignore-null-values-formula-dataview 2018-06-28 13:03:40 +02:00
Simon Martín
ef39a76371 Merge pull request #986 from CartoDB/upgrading-dependencies
upgrading dependencies due to vulnerabilities
2018-06-28 12:43:11 +02:00
Simon Martín
1329f1f535 fix aggregation-dataview test filter 2018-06-28 12:41:52 +02:00
Simon Martín
66f38e8ecd keep the original test name 2018-06-27 18:38:20 +02:00
Simon Martín
e45b41f55a ensuring formula dataview filters infinities, nans and nulls 2018-06-27 18:04:48 +02:00
Simon Martín
995ff52cf3 upgrading dependencies 2018-06-26 17:56:16 +02:00
Iñigo Medina (aka MacGyver)
6e1f66ad94 Create 05-quota-limiting.md 2018-06-26 15:08:36 +02:00
Iñigo Medina (aka MacGyver)
3934e231fe Rename 05-metrics.md to 06-metrics.md 2018-06-26 14:52:44 +02:00
Simon Martín
960eaa5724 Merge pull request #983 from CartoDB/tilejson-url-apikey
tiles base urls with api keys
2018-06-26 10:37:04 +02:00
Simon Martín
37f6ac0c87 Merge branch 'master' into tilejson-url-apikey 2018-06-26 10:23:09 +02:00
Simon Martín
fcc36ddc83 News 2018-06-25 16:31:13 +02:00
Simon Martín
79fdd07d8f adding api key to tiles base urls with querystring 2018-06-25 16:23:23 +02:00
Simon Martín
32ce033c06 improve tests titles 2018-06-25 15:09:18 +02:00
Simon Martín
abb194ca9c test tiles base urls with default_public api key 2018-06-25 15:06:27 +02:00
Javier Goizueta
3161cb0322 Merge pull request #981 from CartoDB/980-dates-as-numbers-tokens
Fix dates_as_numbers for queries with tokens
2018-06-25 14:46:18 +02:00
Daniel G. Aubert
f36cadb809 Merge pull request #985 from CartoDB/add-release-note
Add a release note to advice that a rake task should be performed
2018-06-25 12:55:10 +02:00
Daniel García Aubert
863e42691a Add a release note to advice that a rake task should be performed 2018-06-25 12:51:30 +02:00
Simon Martín
762dce7853 adding api key to tiles base urls 2018-06-22 17:31:45 +02:00
Simon Martín
f0d190d157 tests tiles base urls with api key 2018-06-22 17:31:05 +02:00
Eneko Lakasta
6103d3b8bd Merge pull request #982 from CartoDB/update-camshaft-0.61.11
Upgrades Camshaft to 0.61.11
2018-06-19 15:14:51 +02:00
Eneko Lakasta
7a89f303db Upgrades Camshaft to 0.61.11 2018-06-19 13:58:23 +02:00
Javier Goizueta
b05d9a0a75 Remove only from tests 2018-06-18 13:33:08 +02:00
Javier Goizueta
e89503e1fa Subsitute tokens to get columns for dates_as_numbers
Fixes #980
2018-06-18 13:16:49 +02:00
Javier Goizueta
e0cd1aba29 Refactor: move common token substitutions to query-utils 2018-06-18 13:15:45 +02:00
Javier Goizueta
a5f985257c Tests for dates_as_numbers with tokens 2018-06-18 13:14:17 +02:00
Javier Goizueta
90efe14bfb Merge pull request #971 from CartoDB/cartovl-130
Send dates as unix epoch instead strings in .mvt files
2018-06-13 13:07:35 +02:00
Javier Goizueta
fc9ae9ca20 Update NEWS 2018-06-13 12:54:57 +02:00
IagoLast
649297df83 Use early return 2018-06-13 09:42:53 +02:00
IagoLast
ae7e7578db Use early return 2018-06-13 09:38:24 +02:00
Javier Goizueta
0cf6605b8d Use more precise function name 2018-06-12 12:59:10 +02:00
Javier Goizueta
4a52620d83 Various fixes
This avoids errors when trying to wrap dates or detect wrapped dates in non-mapnik layers
2018-06-12 12:05:31 +02:00
Javier Goizueta
251570b638 Fix tests 2018-06-12 12:04:13 +02:00
Daniel G. Aubert
7660a694cb Merge pull request #970 from CartoDB/mapconfig-provirers-refactor
Mapconfig providers refactor
2018-06-12 10:23:31 +02:00
Raúl Marín
7e7b268a66 Merge pull request #976 from Algunenano/auto_postgis
Test: Make POSTGIS_VERSION detection automatic
2018-06-12 10:09:40 +02:00
Javier Goizueta
660c1777e3 Fix per-layer date wrapping 2018-06-11 19:31:42 +02:00
Javier Goizueta
5407df03fa Implement missing tests 2018-06-11 19:31:15 +02:00
Javier Goizueta
84c34361a0 Fix loop limits, add per layer options in test mapconfig Factory 2018-06-11 19:30:48 +02:00
Raul Marin
50cf5e5c7a Avoid infinite loop 2018-06-11 16:01:29 +02:00
Daniel García Aubert
aba737c61b Merge branch 'master' into mapconfig-provirers-refactor 2018-06-11 15:50:52 +02:00
Raul Marin
9bbbe9e7c1 Make POSTGIS_VERSION detection automatic 2018-06-11 14:47:39 +02:00
Eneko Lakasta
163f494b8a Merge pull request #949 from CartoDB/remove-auth-fallback
Remove auth fallback
2018-06-11 12:35:07 +02:00
Eneko Lakasta
7f7eb78d8c Merge branch 'master' into remove-auth-fallback 2018-06-11 12:02:58 +02:00
Daniel G. Aubert
462d25bebc Merge pull request #974 from CartoDB/fix-statsd-prefix
Use external module to get full qualified domain name properly
2018-06-08 15:30:42 +02:00
Daniel García Aubert
2bf8caf7fc Update fqdn-sync to version 0.2.2 2018-06-08 14:41:31 +02:00
Daniel García Aubert
c6a74b66ce Use external module to get full qualified domain name properly 2018-06-08 13:46:42 +02:00
Raúl Marín
d22619c1f9 Merge pull request #973 from CartoDB/export_fix
Accept `layer` option in static map url request
2018-06-07 16:59:03 +02:00
Daniel G. Aubert
d8b59a18ed Merge pull request #972 from CartoDB/unify-configuration
Unify configuration
2018-06-07 16:36:42 +02:00
Daniel García Aubert
fae6bdff05 Remove duplicated property 2018-06-07 16:33:52 +02:00
Eneko Lakasta
37182f5138 use new cartodb-redis version 2018-06-07 16:10:36 +02:00
Raul Marin
70e8ab8349 Update NEWs 2018-06-07 12:14:31 +02:00
Raul Marin
102244f467 Regression: Accept layer option in the static map urls 2018-06-07 12:14:31 +02:00
Raul Marin
db946b93ec Test: Use cartodb-psql to reset connections instead of calling node-postgres directly
- Avoids an issue with newer npm not finding node-postgres during the tests
as it was required directly but not declared in package.json.
- Avoids an issue with the torque timeouts tests
2018-06-06 13:18:28 +02:00
Javier Goizueta
5b637577c8 Fix conflict resolution gone wrong 2018-06-05 16:30:27 +02:00
Javier Goizueta
0258051f06 Merge branch 'cartovl-130' of github.com:CartoDB/Windshaft-cartodb into cartovl-130
# Conflicts:
#	test/acceptance/date-wrapping.spec.js
2018-06-05 15:43:13 +02:00
Javier Goizueta
2ab22882d6 Slight code trimming 2018-06-05 15:39:15 +02:00
Javier Goizueta
55f6241769 Add date wrapping metadata 2018-06-05 15:39:01 +02:00
Daniel García Aubert
9ec3325cd0 Remove duplicated comments 2018-06-05 15:10:52 +02:00
Daniel García Aubert
e0ab901600 Disable cache-features for test environment 2018-06-05 12:03:26 +02:00
Daniel García Aubert
fcaab30fe7 Enable cahce-features and disable twkb for test environment 2018-06-05 11:51:55 +02:00
IagoLast
e8ecd9b2e0 Fix new test 2018-06-05 11:44:30 +02:00
Daniel García Aubert
22da5a1ff0 Mapnik renderer: do not cache features 2018-06-05 11:35:42 +02:00
Daniel García Aubert
6d0c38371a Do not log date twice 2018-06-05 11:28:42 +02:00
Javier Goizueta
b10cf4bebb New test for casted dates metadata 2018-06-05 11:25:00 +02:00
Daniel García Aubert
6e9871ba4e Revert change: comment analysis logger filename 2018-06-05 11:24:34 +02:00
Daniel García Aubert
13b23d9ec9 Revert change, comment log file configuration again 2018-06-05 11:14:13 +02:00
IagoLast
1491f29f96 Fix tests 2018-06-05 10:10:56 +02:00
IagoLast
9f4b6d5f43 Fix linter 2018-06-05 09:57:48 +02:00
IagoLast
a883514c8a Remove control flag 2018-06-05 09:35:01 +02:00
IagoLast
9ee6d7fc91 Implement multiple layer date wrapping 2018-06-05 09:34:44 +02:00
IagoLast
7df1a19da4 Add test for multiple-layer date wrap 2018-06-05 08:58:44 +02:00
IagoLast
2ee6c8487d PR style fixes 2018-06-05 08:44:20 +02:00
Daniel García Aubert
de3dbb8c1e Missing attribute twkb_encoding set to true 2018-06-04 15:22:32 +02:00
Daniel García Aubert
f851423b68 Unify app configuration among the different enviroments 2018-06-01 16:52:23 +02:00
IagoLast
8ec2b35557 Fix tests 2018-06-01 12:25:36 +02:00
Ubuntu
ae4b233458 Pass tests 2018-06-01 10:18:07 +00:00
Ubuntu
6872d57581 Add tests 2018-06-01 10:08:34 +00:00
elenatorro
79962a7566 Refactor long line 2018-05-31 19:07:57 +02:00
elenatorro
d4c6282455 Refactor date wrapper 2018-05-31 18:53:01 +02:00
elenatorro
db3370cd21 Use wrapDates function from vector adapter 2018-05-31 18:46:23 +02:00
elenatorro
4213e3163a Move queryPromise function 2018-05-31 18:37:43 +02:00
IagoLast
3850bbb68e Send dates as unix epoch instead strings in .mvt files
This commit creates a new ConfigAdapter used in vector maps instantiations.
This adapter generates a new sql query for ONE SINGLE LAYER (carto-vl currently only supports one layer per mvt)
where the date columns are wrapped into a epoch using the `date_part` function.

Due this mvt files are smaller since we use numbers instead strings to represent dates, this is also faster in carto-gl
where we interpolate linearly between 0 and 1 to create animations.

Notice we should add a parameter to make this transformation optional.
We also should take into account the epoch precission.
2018-05-31 17:49:40 +02:00
Daniel García Aubert
ea95050d43 Extract base class in order to share createAffectedTables and getAffectedTables methods 2018-05-31 14:57:34 +02:00
Daniel García Aubert
c32dba1ecb Use ES6 class syntax 2018-05-30 20:28:15 +02:00
Daniel García Aubert
94a5020faf Do not use underscore 2018-05-30 20:10:59 +02:00
Daniel García Aubert
c0e6bf1299 Use ES6 class syntax 2018-05-30 20:08:35 +02:00
Daniel García Aubert
9fe8958e8c Use ES6 class syntax 2018-05-30 20:02:38 +02:00
Daniel García Aubert
7c51895b0f Use const and let instead of var 2018-05-30 19:50:07 +02:00
Daniel García Aubert
16bca85438 Do not use underscore 2018-05-30 19:43:23 +02:00
Daniel García Aubert
9d415d0dbe Extract method to get and build context 2018-05-30 19:30:34 +02:00
Daniel García Aubert
1d0210a372 Reorder code 2018-05-30 19:07:28 +02:00
Daniel García Aubert
2fb6c08702 Remove unnecessary variables 2018-05-30 18:37:11 +02:00
Daniel García Aubert
f7c712f6eb Avoid functions with side effects 2018-05-30 18:31:59 +02:00
Daniel García Aubert
eabd25ee6a Use the returned template instead of the cached one 2018-05-30 18:18:42 +02:00
Daniel García Aubert
5fc49ab3c2 Remove duplicated assignment 2018-05-30 18:16:42 +02:00
Daniel García Aubert
1b6a722c0c Remove step 2018-05-30 18:15:51 +02:00
Eneko Lakasta
6414cd52c0 Merge branch 'master' into remove-auth-fallback 2018-05-30 17:53:24 +02:00
Daniel G. Aubert
f732ed970b Merge pull request #969 from CartoDB/remove-deprecated-base-url-configuration
Remove deprecated base url configuration
2018-05-30 17:36:52 +02:00
Daniel García Aubert
5cfffcfa83 Use const instead of var 2018-05-30 17:22:12 +02:00
Daniel García Aubert
4e28f7bb4e Do not require assert and step 2018-05-30 17:10:18 +02:00
Daniel García Aubert
532d50ad7a Return 'null' explicitly 2018-05-30 17:09:01 +02:00
Daniel García Aubert
d8b0d338c0 Use 'const' instead of 'var' 2018-05-30 17:02:15 +02:00
Daniel García Aubert
cd0be5f79d Do not require 'step' 2018-05-30 17:00:55 +02:00
Daniel García Aubert
3820894454 Do not use 'step' 2018-05-30 17:00:15 +02:00
Daniel García Aubert
9a60ab07a8 Remove deprecated base url configuration 2018-05-30 16:51:37 +02:00
Daniel G. Aubert
12b91e7671 Merge pull request #966 from CartoDB/unify-connection-pool-config
Unify connection pool config
2018-05-30 14:31:39 +02:00
Daniel García Aubert
fe79ee0315 Merge branch 'master' into unify-connection-pool-config 2018-05-29 16:44:21 +02:00
Daniel García Aubert
9c3b3e698e Update yarn.lock 2018-05-29 16:28:23 +02:00
Raúl Marín
ca4eeb332a Merge pull request #967 from CartoDB/psql_update
Update Windshaft, camshaft and cartodb-psql to use cartodb-psql 0.11.0
2018-05-28 18:07:40 +02:00
Raul Marin
794c3efb7d Update Windshaft, camshaft and cartodb-psql to use cartodb-psql 0.11.0 2018-05-28 17:59:25 +02:00
Javier Goizueta
20fe9c45cf Merge pull request #968 from CartoDB/sample-columns
Sample columns
2018-05-28 17:51:38 +02:00
Javier Goizueta
26da872704 Leave sample exclude_columns for later 2018-05-28 17:37:45 +02:00
Javier Goizueta
8a1d5d3a48 Be careful and detect type invalid types 2018-05-28 17:36:58 +02:00
Javier Goizueta
0392a2a343 Merge pull request #963 from CartoDB/refactor-metadata
Refactor metadata queryPromise
2018-05-28 17:20:23 +02:00
Javier Goizueta
34a2f3b32b Tests were missing in previous commit 2018-05-28 16:50:53 +02:00
Javier Goizueta
4bb8914d9a Add parameters to select metadata sample columns 2018-05-28 16:08:31 +02:00
Javier Goizueta
f7c80a0101 Merge branch 'master' into refactor-metadata 2018-05-28 10:49:58 +02:00
Daniel García Aubert
2d417b4a37 Merge branch 'master' into unify-connection-pool-config 2018-05-28 10:47:02 +02:00
Daniel García Aubert
46bb400ffd Cast x-windshaft-cache header in order to fix assertions 2018-05-28 10:46:04 +02:00
Daniel García Aubert
8b05d75f97 Revert test runner filters 2018-05-28 10:32:31 +02:00
Daniel García Aubert
4861d35628 Cast to integer before comparing cache headers 2018-05-28 10:31:48 +02:00
Daniel García Aubert
4a8bfcf647 Revert this commit: try to see what's happening here 2018-05-28 10:03:07 +02:00
Daniel García Aubert
b311f0e091 Add generic pool configuration to postgres global config 2018-05-25 18:38:31 +02:00
Daniel García Aubert
4e4399b727 Missing postgis configuration 2018-05-25 18:00:53 +02:00
Daniel García Aubert
bbab9c1a6b Avoid breaking changes 2018-05-25 14:44:58 +02:00
Daniel García Aubert
5938836ff5 Use default postgres port 2018-05-25 14:36:06 +02:00
Daniel García Aubert
d003790e4d Use the right port again 2018-05-25 14:25:43 +02:00
Daniel García Aubert
1d0fa9a5f6 Use the right port 2018-05-25 14:23:19 +02:00
Daniel García Aubert
8fe192267d cosmetic 2018-05-25 13:37:57 +02:00
Daniel García Aubert
92255797d9 Add torque options to renderer factory 2018-05-25 13:37:34 +02:00
Daniel García Aubert
f404285140 Use postgres pool configuration to have the same configuration for all renderers. 2018-05-24 18:36:45 +02:00
Daniel García Aubert
ee38c717a5 Remove geojson renderer config 2018-05-24 18:11:18 +02:00
Daniel García Aubert
1668392296 Move 'postgres' attributes inside Mapnik's renderer configuration and keep params relative to user's connection 2018-05-24 13:42:32 +02:00
Javier Goizueta
c1feaecbcb Merge branch 'master' into refactor-metadata
# Conflicts:
#	lib/cartodb/backends/layer-stats/mapnik-layer-stats.js
2018-05-23 12:12:36 +02:00
Javier Goizueta
dea1c74fcc Merge pull request #964 from CartoDB/metadata-categories
Add metadata parameter for NULL categories
2018-05-23 12:08:26 +02:00
Javier Goizueta
22a0f2c14e Merge branch 'master' into metadata-categories 2018-05-23 11:17:10 +02:00
Javier Goizueta
94c34eeb23 Small change to use const 2018-05-23 11:15:20 +02:00
Daniel G. Aubert
d63d976916 Merge pull request #965 from CartoDB/fix-random-failures-test
Fix random failures test
2018-05-22 20:11:27 +02:00
Daniel García Aubert
54601db44a Remove test runner filter 2018-05-22 19:41:20 +02:00
Daniel García Aubert
4701decfcd No need to drain test-client 2018-05-22 19:37:46 +02:00
Daniel García Aubert
cc81c8ff4c Only test user database timeout against Postgis Renderer if available (Postgis >= 2.4) 2018-05-22 19:22:08 +02:00
Daniel García Aubert
8febc78d0e Do not test against Postgis renderer because it does not implement renderer timeout option 2018-05-22 19:20:37 +02:00
Daniel García Aubert
87838bd4ce Override cache buster in order to not hit any internal cache 2018-05-22 18:28:57 +02:00
Daniel García Aubert
dfc354550c Add method to override cache buster provided by server while fetching tiles and static images 2018-05-22 18:27:50 +02:00
Daniel García Aubert
ef36466b3b Fix test to use the right helper function to set the user render timeout 2018-05-22 18:19:41 +02:00
Javier Goizueta
7041039572 Add tests for category metadata parameters 2018-05-22 13:42:29 +02:00
Javier Goizueta
97b4e19777 Add metadata parameter for NULL categories 2018-05-22 13:00:18 +02:00
Daniel G. Aubert
55bf6e86f7 Merge pull request #962 from CartoDB/upgrade-dependencies
Upgrade dependencies
2018-05-21 18:06:15 +02:00
Daniel García Aubert
683ec662b5 Merge branch 'master' into upgrade-dependencies 2018-05-21 17:51:14 +02:00
Daniel García Aubert
87c5844704 Update NEWS 2018-05-21 17:47:51 +02:00
Daniel García Aubert
094a0ea76d Upgrade windshaft version to 4.8.0 2018-05-21 17:41:19 +02:00
Javier Goizueta
ebc086106f Refactor metadata queryPromise helper
This function to adapt query execution as a Promise was unnecessary complex.
2018-05-21 17:33:03 +02:00
Javier Goizueta
6384f5538c Rename variable for clarity 2018-05-21 17:06:53 +02:00
Javier Goizueta
befedfd80a Use ifError to check for errors 2018-05-21 17:03:16 +02:00
Javier Goizueta
d828a92ea3 Use ifError to check for errors 2018-05-21 16:59:36 +02:00
Javier Goizueta
4711b28c25 Merge pull request #952 from CartoDB/metadata
Add optional layer metadata at instantiation
2018-05-21 16:05:43 +02:00
Javier Goizueta
d7a90e6be4 Remove debugging comment 2018-05-21 15:54:52 +02:00
Javier Goizueta
267e770c63 Update NEWS 2018-05-21 15:43:32 +02:00
Javier Goizueta
b233f18a0f Modernize code copied from SQL API 2018-05-21 15:43:23 +02:00
Javier Goizueta
32092d212e Fix bug 2018-05-21 14:05:27 +02:00
Daniel García Aubert
b7b52eee80 Upgrade istanbul and jshint version to 0.4.5 and 2.9.5 respectively 2018-05-21 14:04:04 +02:00
Daniel García Aubert
a8da7e60c3 Do not define dependencies in package.json with version ranges 2018-05-21 13:58:17 +02:00
Daniel García Aubert
83e944c985 Upgrade lru-cache version to 4.1.3 2018-05-21 13:29:07 +02:00
Daniel García Aubert
7f841d49b2 Upgrade mocha version to 3.5.3 2018-05-21 13:18:44 +02:00
Daniel García Aubert
bdc52204e4 Upgrade nock version to 9.2.6 2018-05-21 13:01:01 +02:00
Daniel García Aubert
c95b080267 Upgrade yargs version to 11.1.0 2018-05-21 12:47:48 +02:00
Javier Goizueta
11cdcc65ad Add safety limit to sample metadata
The sampling probability is now being computed using an estimate of the table row count
This could led to too high probabilities (to large samples) if the estimate is not accurate.
To avoid potential problems with large samples we've added a LIMIT to the sampling queries.
2018-05-21 12:45:16 +02:00
Daniel García Aubert
1e9ec9e053 Upgrade express version to 4.16.3 2018-05-21 12:30:28 +02:00
Daniel García Aubert
7bafc54280 Upgrade moment version to 2.22.1 2018-05-21 12:27:21 +02:00
Daniel García Aubert
69d5aef59b Upgrade node-statsd version to 0.1.1 2018-05-21 12:21:40 +02:00
Daniel García Aubert
985e61b3c6 Upgrade strftime version to 0.10.0 2018-05-21 12:16:30 +02:00
Daniel García Aubert
15f512a3c7 Upgrade step version to 1.0.0 2018-05-21 12:08:29 +02:00
Daniel García Aubert
1f3f7b4560 Upgrade semver version to 5.5.0 2018-05-21 12:04:23 +02:00
Javier Goizueta
fecd63e582 Fix bug 2018-05-21 11:59:49 +02:00
Daniel García Aubert
a32613c854 Upgrade queue-async to version 1.1.0 2018-05-21 11:58:23 +02:00
Javier Goizueta
38e55367b1 Revert error behaviour for estimatedFeatureCount
Keep current production behavior of ignoreing errors when computing this stat and returning -1.
This is done as to no introduce any instability in production at the moment.
2018-05-21 11:44:52 +02:00
Daniel García Aubert
73b837f4d9 Upgrade request to version 2.87.0 2018-05-21 10:53:29 +02:00
Daniel García Aubert
9b971aa124 Upgrade dot version to 1.1.2 2018-05-21 10:46:29 +02:00
Daniel García Aubert
8479198268 Upgrade body-parser version to 1.18.3 2018-05-21 10:25:04 +02:00
Daniel García Aubert
9daaf5bb6a Use development branch of windshaft 2018-05-21 10:15:22 +02:00
Javier Goizueta
4e99ff1c39 Fix token substitution for stat queries 2018-05-18 22:25:32 +02:00
Javier Goizueta
8e8458e557 Merge branch 'master' into metadata 2018-05-18 20:49:26 +02:00
Javier Goizueta
391ac51f0f Implement metadata queries with plain Promises
Remove usage of PhasedExecution
This achives better query execution granularity and
removes questionable usage of shared results object.
It introduces a couple of behavior changes:
* estimatedFeatureCount desn't ignore errors now
* sample always uses estimatedFeatureCount,even if the actual count is also computed.
2018-05-18 15:33:07 +02:00
Javier Goizueta
4bc8fb207a Use sql_raw for query without aggregation 2018-05-18 15:29:46 +02:00
Daniel G. Aubert
42cd36afb7 Merge pull request #960 from CartoDB/upgrade-camshaft-0.61.9
Upgrade camshaft to version 0.61.9
2018-05-17 14:25:08 +02:00
Daniel García Aubert
dd0436e68e Update NEWS 2018-05-17 13:55:57 +02:00
Daniel García Aubert
d76a0d9f22 Upgrade camshaft to version 0.61.9 2018-05-17 13:47:52 +02:00
Simon Martín
d9e047e20e NEWS 2018-05-17 12:44:31 +02:00
Simon Martín
af35ff7419 Merge pull request #953 from CartoDB/fix-dataview-typeof
handling pg_typeof == undefined error in dataviews
2018-05-17 12:39:16 +02:00
Simon Martín
81bace1dca Merge branch 'master' into fix-dataview-typeof 2018-05-17 12:13:11 +02:00
Simon Martín
38c69de01b Merge pull request #955 from CartoDB/fix-image-format-png
Unsupported static image format
2018-05-17 12:07:54 +02:00
Simon Martín
213ca07c38 Merge branch 'master' into fix-image-format-png 2018-05-17 11:41:30 +02:00
Javier Goizueta
012fa91e83 Typo 2018-05-16 14:45:34 +02:00
Javier Goizueta
3af1182206 Rename misleading function argument 2018-05-16 14:45:19 +02:00
Simon Martín
04e00bb834 Merge branch 'master' into fix-image-format-png 2018-05-16 14:40:59 +02:00
Raúl Marín
df089cb0a5 Merge pull request #958 from CartoDB/windshaft473
Windshaft 4.7.3
2018-05-16 12:30:59 +02:00
Simon Martín
56aa1b39f0 removing 'jpeg' as valid format and no checking agains lowercase 2018-05-16 12:00:40 +02:00
Daniel G. Aubert
d940ab36e1 Merge pull request #954 from CartoDB/controllers-goodies
Controllers goodies
2018-05-14 18:31:48 +02:00
Raul Marin
0f48d51062 Update yarn.lock 2018-05-14 15:01:04 +02:00
Raul Marin
1c5344ba6e Update Windshaft to 4.7.3 2018-05-14 14:54:29 +02:00
Daniel G. Aubert
0d4654122c Merge pull request #956 from CartoDB/add-merge-params-options
Express Routers: Activate mergeParams option
2018-05-14 12:59:44 +02:00
Daniel García Aubert
63a9d58c67 Add regression test 2018-05-14 12:28:57 +02:00
Daniel García Aubert
5a397afd06 In order to extract common middlewares between routers and controlles we need to activate mergeParams options to preserve the req.params from the parent router 2018-05-14 11:50:48 +02:00
Javier Goizueta
b8109401d1 Tests for metadata with aggregation 2018-05-13 13:05:39 +02:00
Javier Goizueta
5e09c80b71 Remove comment 2018-05-11 19:57:49 +02:00
Javier Goizueta
b906f88a44 Slight refactor 2018-05-11 19:32:03 +02:00
Javier Goizueta
24b1b53ba0 Merge branch 'master' into metadata 2018-05-11 18:58:38 +02:00
Javier Goizueta
53fae9fbbd Comment 2018-05-11 18:57:14 +02:00
Simon Martín
ad4ed7a06b detail 2018-05-11 17:47:47 +02:00
Simon Martín
7f5e655730 static image format for last route 2018-05-11 17:45:17 +02:00
Simon Martín
e96a9f0b46 static image format controllers 2018-05-11 17:42:28 +02:00
Simon Martín
db7b4fa937 static image format tests 2018-05-11 17:41:26 +02:00
Simon Martín
7112341c51 checkStaticImageFormat middleware 2018-05-11 17:41:00 +02:00
Daniel García Aubert
f4d60f963d Add comment 2018-05-11 16:37:02 +02:00
Daniel García Aubert
c6babc7dc4 Create .middlewares() method to build midlleware stack to perform request 2018-05-11 16:26:05 +02:00
Daniel García Aubert
3905ed796e Use ES6 class syntax 2018-05-11 16:24:28 +02:00
Daniel García Aubert
595d006d5b Rename function 2018-05-11 16:21:57 +02:00
Daniel García Aubert
3bcf6d7ca0 Place comment 2018-05-11 16:20:44 +02:00
Daniel García Aubert
68f5ee7bde Use ES6 class syntax 2018-05-11 16:18:52 +02:00
Daniel García Aubert
9db6e2161b Use ES6 class syntax 2018-05-11 16:15:33 +02:00
Daniel García Aubert
6eeb75a35e Use .middlewares() method to build middleware stack to process the request 2018-05-11 16:13:34 +02:00
Daniel García Aubert
1f717617b0 Add .middlewares() method to build middleware stack to be mounted 2018-05-11 16:07:25 +02:00
Daniel García Aubert
3d7231929c Create .middlewares() method to return the middlewares to process the request 2018-05-11 15:34:10 +02:00
Javier Goizueta
3b4668cc19 Fix simple tabley sampling 2018-05-11 14:45:12 +02:00
Javier Goizueta
34ad3fcfe8 Add aggregated stat for testing
Also change aggregated stats to not filter a single tile
2018-05-11 14:18:31 +02:00
Daniel García Aubert
242224396d Create .middlewares() method to compose controller actions 2018-05-11 14:05:41 +02:00
Javier Goizueta
68b3cb8a34 Fix estimated row count with aggregations
All stats are computed now pre-aggregation
Code to help compute post-aggregation stats remains for testing
2018-05-11 13:44:43 +02:00
Daniel García Aubert
1cfeda8fe5 Create .middlewares() method to mount corresponding set of middlewares 2018-05-11 13:38:51 +02:00
Daniel García Aubert
33af2d37b3 Remove declared variables but not used 2018-05-11 13:30:25 +02:00
Daniel García Aubert
69505974fe Pass object instead of argument list 2018-05-11 13:29:50 +02:00
Daniel García Aubert
a77dd9a11f Create .middlewares() method to be mounted in dataview controller 2018-05-11 13:20:05 +02:00
Daniel García Aubert
1bc017eac9 Rename function 2018-05-11 12:42:17 +02:00
Daniel García Aubert
07dec2e641 Create .middlwares() to return a set of middlewares to be mounted 2018-05-11 12:38:52 +02:00
Daniel García Aubert
d86a839265 Blank line 2018-05-11 12:22:50 +02:00
Daniel García Aubert
72d8a26ede Use ES6 class 2018-05-11 12:14:27 +02:00
Javier Goizueta
cae4dd81c9 WIP: fix problems for aggregations & metadata 2018-05-10 19:12:47 +02:00
Simon Martín
eba68c56ef handling pg_typeof undefined 2018-05-10 18:36:08 +02:00
Simon Martín
99516f5a75 fix tests and jshint happy 2018-05-10 18:35:52 +02:00
Simon Martín
37a2e89c81 testing expected result with pg_typeof undefined 2018-05-10 18:34:18 +02:00
Simon Martín
ed837fbf22 improving tests raising the pg_typeof error 2018-05-10 17:25:02 +02:00
Simon Martín
913b29070f tests raising pg_typeof error 2018-05-10 15:59:38 +02:00
Daniel G. Aubert
e5ddd57d65 Merge pull request #927 from CartoDB/separate-app-and-controllers-creation
Separate app and controllers creation
2018-05-10 13:19:10 +02:00
Daniel García Aubert
db35ec682a Merge branch 'master' into separate-app-and-controllers-creation 2018-05-09 18:12:06 +02:00
Daniel G. Aubert
111889565a Merge pull request #931 from CartoDB/separate-routers
Separate public API (create a router hierarchy) from monitoring endpoints
2018-05-09 17:57:50 +02:00
Daniel G. Aubert
c68ece96cd Merge pull request #934 from CartoDB/improve-folder-structure
Improve folder structure
2018-05-09 17:26:13 +02:00
Daniel García Aubert
0741881959 Do not initialize status code to 404 when method is OPTIONS 2018-05-09 16:24:38 +02:00
Javier Goizueta
f7745928ab Fix tests
eliminate dependency on the order of PostgreSQL results
2018-05-09 15:42:41 +02:00
Daniel García Aubert
976ee35a35 Use new routes configuration schema in ported test 2018-05-09 15:24:33 +02:00
Daniel García Aubert
c51e254287 Set 404 as defautl status code and set the proper status code fir the response at very same time that the response body 2018-05-09 15:00:18 +02:00
Daniel García Aubert
9feea66550 Use routes configuration to create and mount routes and controllers 2018-05-09 14:59:21 +02:00
Javier Goizueta
ee7bd5fb8a Fix tests 2018-05-09 12:42:42 +02:00
Javier Goizueta
fff5b3d85a Revert debugging changes 2018-05-09 11:59:24 +02:00
Javier Goizueta
d706d0eb22 More travis debugging through commits 2018-05-09 11:44:49 +02:00
Javier Goizueta
944ce80c1e Revert debugging change 2018-05-09 11:42:53 +02:00
Javier Goizueta
d8ef8cb12f Debug travis test failures 2018-05-09 11:08:02 +02:00
Javier Goizueta
eea7bed2f3 Slightly more elegant results of queries 2018-05-08 20:41:42 +02:00
Javier Goizueta
741bcd1a80 Metadata fixes 2018-05-08 20:07:20 +02:00
Javier Goizueta
9c9cfd015d Add test for optional layer metadata 2018-05-08 20:06:14 +02:00
Raúl Marín
39a1b0742f Merge pull request #951 from Algunenano/revert_windshaft472
Revert windshaft472
2018-05-08 19:14:59 +02:00
Raul Marin
03bcf573c3 Revert "Update yarn.lock with the Windshaft 4.7.2"
This reverts commit fa647a915c.
2018-05-08 18:58:04 +02:00
Raul Marin
97d1b4fafa Revert "Update Windshaft to 4.7.2"
This reverts commit 2cf0b9d097.
2018-05-08 18:57:32 +02:00
Raúl Marín
d79d3fd4dc Merge pull request #950 from CartoDB/windshaft472
Update to Windshaft 4.7.2
2018-05-08 18:05:24 +02:00
Eneko Lakasta
f60993b042 re-organize no api key token provided tests - explain tests 2018-05-08 14:41:16 +02:00
Eneko Lakasta
1005126a5f re-organize no api key token provided tests 2018-05-08 14:32:44 +02:00
Raul Marin
fa647a915c Update yarn.lock with the Windshaft 4.7.2 2018-05-08 14:08:12 +02:00
Raul Marin
2cf0b9d097 Update Windshaft to 4.7.2 2018-05-08 14:04:19 +02:00
Javier Goizueta
7d68a2967f Fix: callback expected errors in first argument 2018-05-08 13:08:26 +02:00
Javier Goizueta
b96be69a5c Clarify example 2018-05-08 13:08:01 +02:00
Javier Goizueta
636cd8cd50 Fix:phase execution
phase (not only its tasks) must be executed after the tasks of previous phases
2018-05-08 12:56:06 +02:00
Eneko Lakasta
0536d0abcb add test to check that the fallback api key used if none is sent, is the default public 2018-05-08 11:32:45 +02:00
Javier Goizueta
c647f852d6 Refactor metadata queries execution
Also fixed bug where sampling query generation needed results of count queries
2018-05-08 11:09:09 +02:00
Javier Goizueta
ebab879aca Fix bugs & typos 2018-05-08 11:07:47 +02:00
Javier Goizueta
7561635b24 WIP:add layer metadata 2018-05-07 19:03:19 +02:00
Daniel García Aubert
7ed819e84a Merge branch 'separate-routers' into improve-folder-structure 2018-05-07 18:29:53 +02:00
Daniel García Aubert
407a83e81d Merge branch 'separate-app-and-controllers-creation' into separate-routers 2018-05-07 18:29:00 +02:00
Daniel García Aubert
3c3731252d Respect default values with object.assign 2018-05-07 18:24:41 +02:00
Daniel García Aubert
8b64328087 Merge branch 'separate-routers' into improve-folder-structure 2018-05-07 17:28:20 +02:00
Daniel García Aubert
f1bb5b3d1d Merge branch 'separate-app-and-controllers-creation' into separate-routers 2018-05-07 17:27:32 +02:00
Daniel García Aubert
7aeab47df4 Merge branch 'master' into separate-app-and-controllers-creation 2018-05-07 17:27:00 +02:00
Eneko Lakasta
e1b848afd0 use matching cartodb-redis branch [fix] 2018-05-07 16:36:09 +02:00
Eneko Lakasta
f111ddf449 use matching cartodb-redis branch and run all tests 2018-05-07 16:07:28 +02:00
Eneko Lakasta
534c827904 remove auth fallback 2018-05-07 15:44:44 +02:00
Simon Martín
efa765a9fc Merge pull request #945 from CartoDB/docker-tests
Travis tests: xenial+pg10 and precise+pg9.5
2018-05-07 10:56:15 +02:00
Simon Martín
910f5693d8 updating news 2018-05-07 10:43:15 +02:00
Simon Martín
7c5ed7e8f8 using the correct docker account 2018-05-03 17:38:54 +02:00
Simon Martín
066626d928 simplify docker commands 2018-05-03 11:18:09 +02:00
Simon Martín
6bb8c9c271 EOF line 2018-05-03 10:47:20 +02:00
Simon Martín
e76850fce6 updating docker-test with new run_tests_docker.sh 2018-04-27 15:47:40 +02:00
Simon Martín
8d3503e0fc removing unneeded configuration 2018-04-27 15:46:57 +02:00
Simon Martín
9788af4273 adding ENV vars and Postgres configuration. Also, Postgres starts auto 2018-04-27 15:46:10 +02:00
Simon Martín
4442200d6b EOF line 2018-04-27 13:08:46 +02:00
Simon Martín
02b12f370a adding an small docker reference 2018-04-27 13:05:52 +02:00
Simon Martín
dce6349fcb sudo required to right place 2018-04-27 12:01:56 +02:00
Simon Martín
862c79ee16 removing docker image for xenial and pg95 2018-04-27 11:58:05 +02:00
Simon Martín
29c1d74202 adding redis 4 to travis 2018-04-27 11:48:35 +02:00
Simon Martín
d83679c895 ensuring postgres version 2018-04-27 11:39:30 +02:00
Simon Martín
62bdbed1d5 setting yarn version in previous travis version 2018-04-27 11:07:20 +02:00
Simon Martín
390a2b573f test last travis configuration previous to docker 2018-04-27 10:57:47 +02:00
Simon Martín
bbbd7ab41c forcing yarn install with env params 2018-04-27 10:47:39 +02:00
Simon Martín
85eb82a175 gcc in travis 2018-04-27 10:37:32 +02:00
Simon Martín
82189d35e0 removing create publu user 2018-04-27 10:28:04 +02:00
Simon Martín
f880e86cd1 removing configure in travis 2018-04-27 10:20:55 +02:00
Simon Martín
87f30a3633 installing yarn in travis 2 2018-04-26 17:10:40 +02:00
Simon Martín
47b029a871 updating g++ in travis 2018-04-26 17:00:37 +02:00
Simon Martín
b16e2cad19 install yarn in travis 2018-04-26 16:57:14 +02:00
Simon Martín
f8b347a03a postgres 9.5 without docker in travis 2018-04-26 16:31:32 +02:00
Simon Martín
12da3a58fc postgres 10 working with maps and sql 2018-04-26 13:12:25 +02:00
Simon Martín
73d7ee37f8 travis in parallel 4 2018-04-24 18:15:10 +02:00
Simon Martín
7fdee0ebe5 travis in parallel 2018-04-24 18:07:31 +02:00
Simon Martín
9437b35c8c travis in paralell 2 2018-04-24 18:02:59 +02:00
Simon Martín
78326629f3 trying travis tests in parallel 2018-04-24 18:00:17 +02:00
Simon Martín
db4c3b70bb travis build stages 2 2018-04-24 17:49:38 +02:00
Simon Martín
09d937f533 travis build stages 2018-04-24 17:41:29 +02:00
Simon Martín
d3615e8d2b pull images before run tests 2018-04-23 16:18:22 +02:00
Simon Martín
aeaf325e2a travis tests with both images 2018-04-23 16:00:46 +02:00
Simon Martín
d629dc24ae removing default commands from image 2018-04-23 15:40:16 +02:00
Simon Martín
d8c356e350 changing name of docker sh to run_tests_docker 2018-04-23 15:39:01 +02:00
Simon Martín
55d2dcca04 adding first version of docker images 2018-04-23 15:26:42 +02:00
Daniel García Aubert
9bd9503e9b Merge paths to perform the same middleware stack 2018-04-18 19:07:38 +02:00
Daniel García Aubert
56495522b8 Use array of path to avoid collisions and extract scale-factor param properly 2018-04-18 18:52:09 +02:00
Daniel García Aubert
9d1d5c439b Merge branch 'separate-routers' into improve-folder-structure 2018-04-18 17:08:11 +02:00
Daniel García Aubert
be5e419288 Merge branch 'separate-app-and-controllers-creation' into separate-routers 2018-04-18 17:06:53 +02:00
Daniel García Aubert
8afe6c5228 Merge branch 'master' into separate-app-and-controllers-creation 2018-04-18 17:05:27 +02:00
Daniel G. Aubert
20b46a33cf Merge pull request #944 from CartoDB/improve-test-suite
Improve test suite
2018-04-18 16:58:52 +02:00
Daniel García Aubert
1694b4b3a6 Merge branch 'separate-routers' into improve-folder-structure 2018-04-17 16:07:47 +02:00
Daniel García Aubert
5b1b78d386 Merge branch 'separate-app-and-controllers-creation' into separate-routers 2018-04-17 15:56:33 +02:00
Daniel García Aubert
9c249596c0 Merge branch 'master' into separate-app-and-controllers-creation 2018-04-17 15:55:38 +02:00
Iñigo Medina
c8273cec2c Update 02-contribute.md 2018-04-17 14:43:50 +02:00
Raúl Marín
36394520ff Merge pull request #936 from CartoDB/mvt-invalid-props
MVT: Different types/values for same property in same feature in different tiles
2018-04-17 12:33:44 +02:00
Raul Marin
45adaf5dc2 Merge remote-tracking branch 'blessed/master' into mvt-invalid-props 2018-04-17 12:08:57 +02:00
Daniel G. Aubert
be0680675b Merge pull request #943 from CartoDB/validate-coords
Add coordinates validation to specific endpoints
2018-04-17 11:43:28 +02:00
Daniel García Aubert
6c466d13ff Typo 2018-04-17 11:36:33 +02:00
Daniel García Aubert
9905b20448 Improve naming 2018-04-17 11:22:05 +02:00
Daniel García Aubert
2ff410946a Add test to check that the regexp validates just digits 2018-04-17 11:20:15 +02:00
Daniel García Aubert
94be7e5294 Update NEWS 2018-04-17 11:13:33 +02:00
Daniel García Aubert
da3939239f Fix test assertions 2018-04-17 11:10:34 +02:00
Simon Martín
adefbb3365 query with template string 2018-04-17 11:05:37 +02:00
Daniel García Aubert
8000a51918 Improve error messages 2018-04-17 11:04:03 +02:00
Daniel García Aubert
7012c6e77a Test: Let the OS to choose a random free port to make the tiler listen at it 2018-04-17 10:44:44 +02:00
Raul Marin
13843772d4 Update NEWS 2018-04-17 10:42:38 +02:00
Raul Marin
ad4cd2067b JShint fix 2018-04-17 10:39:39 +02:00
Raul Marin
ff3efd7d56 Update Windshaft to 4.7.1 2018-04-17 10:31:32 +02:00
Raul Marin
8d6a406779 Merge remote-tracking branch 'carto/master' into mvt-invalid-props 2018-04-17 10:25:05 +02:00
Daniel García Aubert
98d15e2e34 Typo 2018-04-16 18:57:28 +02:00
Daniel García Aubert
d5c591317b Add coordinates validation to specific endpoints 2018-04-16 18:55:42 +02:00
Daniel García Aubert
817afb13d1 Use mocha hooks to create server just before perform the test 2018-04-16 16:16:23 +02:00
Daniel García Aubert
98f29f945b Create application server inside of describes instead of at module level 2018-04-16 14:09:24 +02:00
Rafa de la Torre
09fdf5b990 Stub next version 2018-04-16 11:53:06 +02:00
Rafa de la Torre
b760aa8c63 Release v6.1.0 2018-04-16 11:51:04 +02:00
Rafa de la Torre
a83e6b6929 Merge pull request #929 from CartoDB/config_markers_symbolizer_caches
Config for markers symbolizer caches
2018-04-16 11:47:13 +02:00
Rafa de la Torre
64fa18220f Update NEWS.md 2018-04-16 10:36:42 +02:00
Rafa de la Torre
b11a766c28 Add config for markers_symbolizer_caches examples 2018-04-16 10:36:42 +02:00
Rafa de la Torre
c2c3993887 Upgrade windshaft to 4.7.0 2018-04-16 10:36:36 +02:00
Eneko Lakasta
35459b7332 Merge pull request #938 from CartoDB/named-map-auth-tests
Named map auth tests
2018-04-13 12:56:49 +02:00
Daniel G. Aubert
1b8e37a62c Merge pull request #940 from CartoDB/regression-test-named-map-dataview-filter
Regression test named map dataview filter
2018-04-13 12:45:34 +02:00
Iñigo Medina
b117e7e2bb Rename 05-timeout-limiting.md to 04-timeout-limiting.md 2018-04-13 00:01:51 +02:00
Iñigo Medina
64fd2304a9 Create 05-timeout-limiting.md 2018-04-13 00:01:32 +02:00
Iñigo Medina
6b521e9985 Rename 04-metrics.md to 05-metrics.md 2018-04-13 00:00:50 +02:00
Iñigo Medina
2e19bf5b17 Create 03-rate-limiting.md 2018-04-13 00:00:30 +02:00
Iñigo Medina
69f41a0200 Update and rename 01-metrics.md to 04-metrics.md 2018-04-12 23:58:47 +02:00
Iñigo Medina
3cbf741209 Create 02-contribute.md 2018-04-12 23:41:54 +02:00
Iñigo Medina
9d2473bbe3 Create 01-support-options.md 2018-04-12 23:40:39 +02:00
Daniel García Aubert
89cc9ad27d Merge branch 'master' into regression-test-named-map-dataview-filter 2018-04-12 20:53:27 +02:00
Daniel García Aubert
d8a5dc586d Add test to check dataview filters when instantiating a named map 2018-04-12 19:58:33 +02:00
Daniel G. Aubert
837b2f7558 Merge pull request #937 from CartoDB/add-map-intantiation-regression-test
Add test to check regression when instantiating a map
2018-04-12 19:07:48 +02:00
Daniel García Aubert
1df7df21d5 Revert removed line 2018-04-12 18:31:22 +02:00
Daniel García Aubert
53a40de2e7 Use another table 2018-04-12 18:24:00 +02:00
Eneko Lakasta
940cafacac add newline add EOF 2018-04-12 17:51:33 +02:00
Eneko Lakasta
d1ba4a1759 remove unnecessary test 2018-04-12 17:41:07 +02:00
Daniel García Aubert
6437e2ec67 Add test to check regression when cache buster during instantiation is not updated 2018-04-12 16:32:44 +02:00
Eneko Lakasta
31e3b9953f add named maps GET auth tests 2018-04-12 16:22:56 +02:00
Eneko Lakasta
f5bdb8b15b add named maps Update auth tests 2018-04-12 16:03:02 +02:00
Eneko Lakasta
fbcf312071 add named maps Delete auth tests 2018-04-12 14:46:08 +02:00
Eneko Lakasta
9a7a8a3243 add named maps Create auth tests 2018-04-12 12:43:41 +02:00
Simon Martín
fc36950c1d fix errored value in test 2018-04-12 11:27:31 +02:00
Simon Martín
b4ca44f096 Merge branch 'mvt-invalid-props' of github.com:CartoDB/Windshaft-cartodb into mvt-invalid-props 2018-04-12 10:46:45 +02:00
Simon Martín
4978dd86ac simply cases of mvt property type changes 2018-04-12 10:46:21 +02:00
Daniel García Aubert
730b29c9cc Remove defined dependecies but never used 2018-04-11 18:51:44 +02:00
Raul Ochoa
4d631d1b6a Merge branch 'master' into mvt-invalid-props 2018-04-11 14:08:29 +00:00
Raul Ochoa
2d2629c088 improve description for suite and test 2018-04-11 14:08:18 +00:00
Daniel García Aubert
9a52edacb2 Add routes configuration to config example files 2018-04-11 16:00:14 +02:00
Raul Ochoa
67411e32ff Validate property with strict check and use full table
It seems related to using the full table. The geometry column is a
simplified to reduce the file size, it uses the envelope of the original
geometries.
2018-04-11 11:40:55 +00:00
Daniel García Aubert
e06d3200c3 Use a better API to define public routes 2018-04-11 12:33:07 +02:00
Eneko Lakasta
9a3eb3e0fd add named maps Listing auth tests 2018-04-11 12:26:09 +02:00
Raul Ochoa
a7c96acc81 Run all tests 2018-04-11 10:13:24 +00:00
Raul Ochoa
f2ab33b498 Add regression test for invalid MVT properties 2018-04-11 10:03:06 +00:00
Javier Goizueta
6a7c9e34a0 Merge pull request #920 from CartoDB/regression-mvt-postgis-agg-column-name
Error with aggregations and MVT Postgis backend
2018-04-11 11:15:45 +02:00
Raul Ochoa
6c8b3d2f8f Merge branch 'master' into regression-mvt-postgis-agg-column-name 2018-04-11 08:34:28 +00:00
Daniel García Aubert
c0943a7c58 Use config to define base path for express routers 2018-04-10 20:26:36 +02:00
Daniel G. Aubert
5d230c444c Merge pull request #928 from CartoDB/extract-cors-mw
Make cors middleware more generic and link it just to application level
2018-04-10 18:29:59 +02:00
Daniel García Aubert
ac615b4a25 Merge branch 'separate-routers' into improve-folder-structure 2018-04-10 16:15:49 +02:00
Daniel García Aubert
bc45b50290 Merge branch 'separate-app-and-controllers-creation' into separate-routers 2018-04-10 15:59:05 +02:00
Daniel García Aubert
1bbd84b37a Please jshint 2018-04-10 15:56:52 +02:00
Daniel García Aubert
aa3fb4807b Merge branch 'master' into separate-app-and-controllers-creation 2018-04-10 15:25:36 +02:00
Daniel García Aubert
d1a4057a8d Rename user limits api by user limits backend 2018-04-10 10:16:07 +02:00
Daniel García Aubert
8519d2724b Rename tables extent api by tables extent backend 2018-04-10 09:40:09 +02:00
Daniel García Aubert
ba36a47228 Rename overviews metadata api by overviews metadata backend 2018-04-09 19:47:43 +02:00
Daniel García Aubert
e0d8dc0334 Rename filter stats api by filter stats backend 2018-04-09 18:56:01 +02:00
Daniel García Aubert
8dec4814a9 Rename AuthAppi by AuthBackend 2018-04-09 18:08:56 +02:00
Daniel García Aubert
6167562758 Meet application logic and folder struture 2018-04-09 16:18:30 +02:00
Daniel García Aubert
7e68f5270d Move application middlewares to routers folder 2018-04-06 18:20:33 +02:00
Daniel G. Aubert
a24b7d4c8f Merge pull request #933 from CartoDB/4252-fix-named-map-auth
Forbid access to named map admin resources for everyone but master
2018-04-06 15:31:15 +02:00
Daniel García Aubert
25aa967146 Forbid access to named map admin resources for everyone but master 2018-04-06 15:26:11 +02:00
Daniel García Aubert
3bfc7d3d23 Rename controllers folder by routers 2018-04-06 13:53:50 +02:00
Simon Martín
430a3e3fc9 Merge pull request #932 from CartoDB/fix-layergroupid-date
Fix layergroupid date
2018-04-06 13:35:11 +02:00
Simon Martín
c94d782037 calling to new createAffectedTables 2018-04-06 13:00:12 +02:00
Simon Martín
233f9698f3 fix affectedtables cache 2018-04-06 12:59:53 +02:00
Daniel García Aubert
61fc15cec0 Add comment to indicate deprecated paths 2018-04-06 11:13:34 +02:00
Daniel García Aubert
4e754e0d86 Create API router to handle common stuff among child routers 2018-04-05 19:42:20 +02:00
Javier Goizueta
125ab7d95e Merge pull request #930 from CartoDB/cartovl-cartodb_id
Make cartodb_id unique in aggregations
2018-04-05 16:46:23 +02:00
Javier Goizueta
26c5ff1f93 Update news 2018-04-05 16:36:07 +02:00
Javier Goizueta
ffa3a96f1a Use unique cartodb_id in aggregated results
See #889
FOr centroid and point-grid the cartodb_id wasn't unique across tiles.
2018-04-05 14:06:27 +00:00
Javier Goizueta
9818d8bb6c Merge branch 'master' into cartovl-cartodb_id 2018-04-05 16:02:03 +02:00
Javier Goizueta
f7fad736c3 Add test for uniqueness of aggregated cartodb_id 2018-04-05 16:01:29 +02:00
Javier Goizueta
62cc99c1c9 Merge pull request #913 from CartoDB/cartogl
Aggregation filters
2018-04-05 12:23:44 +02:00
Javier Goizueta
44424583f0 Revert "Use unique cartodb_id in aggregated results"
This reverts commit c1da1a8a16.
This is reverted for moving the change out of PR #913 into its own PR for clarity.
2018-04-05 12:12:58 +02:00
Javier Goizueta
98cb0878d9 Update NEWS
Reflect the changes in #913
2018-04-05 12:12:00 +02:00
Daniel García Aubert
5aa63d35ce Add comments 2018-04-04 20:07:53 +02:00
Daniel García Aubert
11099c88dc Improve routing via regular expressions 2018-04-04 20:00:59 +02:00
Daniel García Aubert
ef22c46199 Make send-response middleware generic to the router 2018-04-04 19:15:51 +02:00
Javier Goizueta
e8cd6856b5 Add missing aggregation columns to ST_AsMVT
Aggregation results always should have the cartodb_id and the feature count
2018-04-04 17:18:56 +02:00
Javier Goizueta
3d36802686 Tests for columns present in aggregation MVTs 2018-04-04 16:58:11 +02:00
Javier Goizueta
dc706aeb43 Fix bug with dimension aliases
The point-sample aggregation query failed if dimensions had alias different from the base columns
2018-04-04 16:29:40 +02:00
Javier Goizueta
071b6816e3 Fix docs typos in _cdb_feature_count 2018-04-04 16:28:07 +02:00
Daniel García Aubert
cfdff61d08 Create map & template routers to skip unneeded middlewares in monitor endpoints 2018-04-04 15:52:54 +02:00
Javier Goizueta
2132960d7c Fix non-default aggregation columns
The columns for non-default aggregations were the base columns not the resulting aggregated columns
In particular this could cause invalid wrapped SQL code to be passed to ST_AsMVT when the Windshaft pg-mvt renderer was used.
2018-04-04 15:25:08 +02:00
Javier Goizueta
fefb0b23af Merge branch 'master' into cartogl 2018-04-04 12:21:43 +02:00
Javier Goizueta
c1da1a8a16 Use unique cartodb_id in aggregated results
See #889
FOr centroid and point-grid the cartodb_id wasn't unique across tiles.
2018-04-04 11:05:03 +02:00
Daniel García Aubert
93bdbb1c50 Create monitor monitor router 2018-04-03 19:16:37 +02:00
Daniel García Aubert
f1e421db05 Create an api router isolated from heath checks 2018-04-03 19:08:56 +02:00
Daniel García Aubert
462ba62656 Make cors middleware more generic and link it just to application level 2018-04-03 15:32:29 +02:00
Daniel García Aubert
5cd073c96f Remove old controller from bad merge 2018-04-03 14:50:24 +02:00
Daniel García Aubert
40b8d865a9 Merge branch 'master' into separate-app-and-controllers-creation 2018-04-03 14:45:49 +02:00
Daniel García Aubert
a21d7db390 Extract json-replacer 2018-04-03 13:21:41 +02:00
Daniel García Aubert
cc61a89c68 Remove function 2018-04-03 12:27:45 +02:00
Daniel García Aubert
3316c2ded3 Create logger middleware to encapsulate its configuration from app 2018-04-03 12:26:35 +02:00
Daniel García Aubert
b6989ac82a Create a controllers factory where all collaborators are created and controllers are mounted afterwards 2018-04-02 19:02:31 +02:00
Daniel García Aubert
6bf06116df Build controllers (analysis and server info) in server 2018-03-28 20:12:11 +02:00
Daniel García Aubert
5bb5bc42ee Create Map Controller while building server 2018-03-28 19:58:30 +02:00
Daniel García Aubert
57e10a8d2b Create layergroup controllers in server construction 2018-03-28 19:37:31 +02:00
Daniel García Aubert
51fade6bd3 Ensure each controller only receives one router 2018-03-28 19:11:19 +02:00
Daniel
48ffe5e660 Merge pull request #922 from CartoDB/fix-category-filter
Add query params when instantiating template
2018-03-28 16:06:55 +02:00
Daniel García Aubert
22fdc3d1bf Add query params when instantiating template 2018-03-28 15:53:34 +02:00
Daniel García Aubert
04b65c7c0d Please jshint 2018-03-28 14:21:20 +02:00
Daniel García Aubert
3576eb8081 Do not use template strings 2018-03-28 14:16:13 +02:00
Daniel García Aubert
9377b73aa3 Extract map error middleware 2018-03-28 14:12:21 +02:00
Daniel García Aubert
e5aff3f366 Extract layergroup-metadata middleware 2018-03-28 14:06:23 +02:00
Daniel García Aubert
78356ab298 Extract layergroupIdHeader middleware 2018-03-28 13:41:41 +02:00
Daniel García Aubert
947a367865 Extract layerStats middleware 2018-03-28 13:31:37 +02:00
Daniel García Aubert
e79d9ec2f9 Extract lastUpdatedTimeLayergroup middleware 2018-03-28 13:27:01 +02:00
Daniel García Aubert
16e8451166 Extract augment layergroup data middleware 2018-03-28 13:10:47 +02:00
Daniel García Aubert
1d54a8dccd Extract increment map view count middleware 2018-03-28 13:01:23 +02:00
Daniel García Aubert
b68d2d9115 Extract checkJsonContentType middleware 2018-03-28 12:49:11 +02:00
Daniel García Aubert
64d540f23b Extract initProfiler middlewar 2018-03-28 12:45:03 +02:00
Daniel García Aubert
d8d681e8bc Create separated controllers (named & anonymous) for map controller 2018-03-28 12:39:39 +02:00
Daniel García Aubert
5b9f608667 Use express routers 2018-03-27 18:46:54 +02:00
Daniel García Aubert
7660046720 Merge branch 'master' into extract-common-mw 2018-03-27 17:25:33 +02:00
Daniel
0315b32d2b Merge pull request #917 from CartoDB/903-locals-refactor
Locals middleware refactor
2018-03-27 17:23:41 +02:00
Daniel García Aubert
5f906e54e4 Merge branch 'master' into 903-locals-refactor 2018-03-27 15:44:54 +02:00
Daniel
143f0ea67b Merge pull request #918 from CartoDB/layergroup-split
Layergroup split
2018-03-27 15:44:06 +02:00
Daniel
0aa2cffb5e Merge pull request #914 from CartoDB/unify-middlewares
Unify sendResponse middleware
2018-03-27 15:33:23 +02:00
Daniel
f2a7953d9d Merge pull request #915 from CartoDB/unify-headers-middlewared
Unify headers middlewares
2018-03-27 12:38:23 +02:00
Daniel García Aubert
f231dc13cf Merge branch 'master' into unify-middlewares 2018-03-27 10:41:35 +02:00
Daniel García Aubert
a107ee67fa Use arrow function 2018-03-27 10:32:22 +02:00
Daniel García Aubert
cb488cbde8 Extract middleware served by host header 2018-03-26 19:53:33 +02:00
Raul Ochoa
18d3da66f3 Merge branch 'master' into regression-mvt-postgis-agg-column-name 2018-03-26 16:52:57 +00:00
Raul Ochoa
61dd92129a Merge pull request #919 from CartoDB/rediscell-macosx
Fix test environment in Mac OS X re:redis-cell
2018-03-26 18:48:18 +02:00
Raul Ochoa
489c0f3108 Going red: regression with aggregations and MVT Postgis backend 2018-03-26 16:44:31 +00:00
Raul Ochoa
e327580a2f Remove downloading function
If we are using a fixed release version, it doesn't make sense to keep downloading it.
2018-03-26 17:54:32 +02:00
Raul Ochoa
bd9c28e29c Use specific redis cell SO depending on OS 2018-03-26 17:53:36 +02:00
Raul Ochoa
f4d7148f66 Include shared objects for both, mac and linux, OS 2018-03-26 17:52:32 +02:00
Raul Ochoa
1dd5bc8f14 Do not ignore redis-cell SO 2018-03-26 17:52:00 +02:00
Daniel García Aubert
59db640d0d Typo 2018-03-26 16:05:53 +02:00
Daniel García Aubert
4bb35f5fab Extract cors and user middlewares and set them up at application level 2018-03-26 15:37:44 +02:00
Simon Martín
967a0c31fd Merge pull request #916 from CartoDB/finalDetails
Rate limits final details
2018-03-26 11:51:04 +02:00
Daniel García Aubert
c5c8dd7ad7 Split layergroup controllers into small controllers 2018-03-23 21:20:37 +01:00
Daniel García Aubert
d3e2707fce Tidy middlewares up: put rate limit middleware after authorization 2018-03-23 17:55:41 +01:00
Daniel García Aubert
4cba4c7a1f Tidy middlewares up: cleanUpQeuryParams 2018-03-23 17:37:06 +01:00
Daniel García Aubert
3b1fd05940 Use layergroup token middleware where it's actually needed 2018-03-23 17:24:56 +01:00
Daniel García Aubert
5bc5c0ae86 Remove locals middleware 2018-03-23 16:53:00 +01:00
Daniel García Aubert
5fc801f8a6 Do not use locals middleware in named maps controller 2018-03-23 16:38:55 +01:00
Daniel García Aubert
f7a23c094c Do not use locals middleware in named maps admin controller 2018-03-23 16:16:53 +01:00
Daniel García Aubert
516b1f765e Do not use middleware local in map controller 2018-03-23 16:08:52 +01:00
Simon Martín
d28c915635 jshint happy 2018-03-23 15:57:30 +01:00
Daniel García Aubert
f76606bc26 Do not use locals middleware in layergroup controller 2018-03-23 14:13:27 +01:00
Daniel García Aubert
7ba3394508 Do not merge req.params and req.query into res.locals (don't use locals middleware in analysis controller) 2018-03-23 14:10:27 +01:00
Simon Martín
f19eeff899 returning error mvt on rate limit 2018-03-23 13:30:47 +01:00
Daniel García Aubert
d3c9da6d5f Fix layer filter by query params 2018-03-23 11:57:28 +01:00
Simon Martín
1ce908177e correct error message in rate limit tests 2018-03-23 11:47:28 +01:00
Simon Martín
609bf13765 correct error message in rate limit 2018-03-23 11:42:53 +01:00
Daniel García Aubert
97a49fab2f Remove function defined but nerver used 2018-03-23 11:33:40 +01:00
Daniel García Aubert
10ead27676 Pass only needed properties to named map provider cache (static endpoint) 2018-03-23 11:23:19 +01:00
Daniel García Aubert
8be7ea5cc1 Pass only needed properties to named map provider cache 2018-03-23 11:01:36 +01:00
Daniel García Aubert
ebefba9e32 Revert: move map-config assignment 2018-03-23 10:57:35 +01:00
Simon Martín
fb784d6a91 removing retry after when no necessary 2018-03-23 10:23:57 +01:00
Daniel García Aubert
c31639ebbd Move assignments 2018-03-22 19:38:56 +01:00
Daniel García Aubert
4ff8d6fbc3 Pass only needed params to map backend 2018-03-22 19:37:08 +01:00
Daniel García Aubert
d029f81992 Pass only needed params to create layergroup map config provider 2018-03-22 19:36:42 +01:00
Daniel García Aubert
6b7c2675f1 Use database params module 2018-03-22 19:20:51 +01:00
Daniel García Aubert
4f8c184bc0 Pass only needed params to map config adapter 2018-03-22 19:14:18 +01:00
Daniel García Aubert
afc608fc5d Pass only needed params to named map map config provider 2018-03-22 18:57:26 +01:00
Daniel García Aubert
8523875349 Remove function thet is never used 2018-03-22 18:29:00 +01:00
Daniel García Aubert
79955c7fac Pass only needed params to tile backend 2018-03-22 18:27:40 +01:00
Daniel García Aubert
d3cbd70054 Pass only needed params to attributes backend backend 2018-03-22 18:16:41 +01:00
Daniel García Aubert
81706b8726 Pass only needed params to dataview backend (search) 2018-03-22 18:03:38 +01:00
Daniel García Aubert
2812a54210 Pass only needed params to dataview backend 2018-03-22 17:55:15 +01:00
Daniel García Aubert
258d768887 Use upercase for constants 2018-03-22 17:54:40 +01:00
Daniel García Aubert
1059066c05 Use module to get database parameters 2018-03-22 17:53:24 +01:00
Daniel García Aubert
875f3c07b3 Pass only needed params to MapStoreMapConfigProvider 2018-03-22 17:07:38 +01:00
Daniel García Aubert
8ce72ea842 Do not pass res.locals to collaborators 2018-03-22 12:30:51 +01:00
Daniel García Aubert
e542d38ec7 Reorder middleware 2018-03-22 11:38:33 +01:00
Daniel
771eaf97c8 Merge pull request #909 from CartoDB/spread-prepare-context-middleware
Spread `prepareContext` middleware
2018-03-22 10:48:37 +01:00
Daniel García Aubert
b40ed13f47 Do not use step to deal with asyn code 2018-03-21 19:08:37 +01:00
Javier Goizueta
b9de49d5ab Remove superfluous aggregation filter condition
The default aggregation doesn't admit filters, so this wasn't necessary.
2018-03-21 17:36:26 +01:00
Javier Goizueta
ead6fa5f1f Document aggregation filters
Note that dimension filters remain undocumented
2018-03-21 17:21:05 +01:00
Javier Goizueta
6ada8ba6a2 Implement aggregation filters 2018-03-21 17:01:32 +01:00
Daniel García Aubert
672b19b106 Magic number 2018-03-21 16:48:21 +01:00
Daniel García Aubert
4a2580c9ea Missing semicolon 2018-03-21 16:43:34 +01:00
Daniel García Aubert
52c8c9341a Remove function defined but never used 2018-03-21 16:40:09 +01:00
Daniel García Aubert
72c4a7abd6 Extract cache control header middleware 2018-03-21 16:38:37 +01:00
Daniel García Aubert
d022a1fa5e Extract last-modified header middlleware 2018-03-21 14:43:00 +01:00
Daniel García Aubert
a142620b70 Make generic middlewares to calculate surrogate key and cache channel headers:
- In controllers: all reference to map config are now camelized, for instance: mapconfig -> mapConfig or mapconfigProvider -> mapConfigProvider
 - In controllers: all map config providers created in req/res cycle are saved into `res.locals` and `mapConfigProvider` as key.
 - In map-config-providers: all of them implement `.getAffectedTables()`, in order to calculate the tables involved for a given map-config. For that, `pgConnection` and `affectedTablesCache` are injected as constructor argument.
 - Named Map Provider: rename references from `affectedTablesAndLastUpdate` to `affectedTables`.
 - Named Map Provider Cache: In order to create new named map providers, needs affectedTablesCache.
 - Extract locals middlewares (surrogate-key and cache-channel) from controllers and create an unified version of them.
 - Extract last-modified middleware from named maps controller (draft).
2018-03-21 14:11:54 +01:00
Simon Martín
5603336253 stubs next version 2018-03-20 14:51:37 +01:00
Raúl Marín
838a3464c1 Merge pull request #911 from Algunenano/master_pg11
PG11: Modify regex match to accept pg11 errors
2018-03-20 11:47:14 +01:00
Raul Marin
0906ae3c93 PG11: Modify regex match to accept pg11 errors 2018-03-20 11:34:30 +01:00
Daniel García Aubert
af8ed99ae7 Merge branch 'spread-prepare-context-middleware' into unify-middlewares 2018-03-20 11:09:32 +01:00
Daniel García Aubert
f8d1e159f4 Please jshint 2018-03-20 11:09:05 +01:00
Daniel García Aubert
df999e040c Merge branch 'spread-prepare-context-middleware' into unify-middlewares 2018-03-20 11:06:31 +01:00
Daniel García Aubert
2e13bc42a1 Merge branch 'master' into spread-prepare-context-middleware 2018-03-20 11:01:13 +01:00
Daniel García Aubert
9fd2519c12 Rename middleware 2018-03-20 09:34:50 +01:00
Daniel García Aubert
325bdfe92f Move middleware 2018-03-20 09:34:06 +01:00
Daniel García Aubert
9211fa065b Extract sendResponse middleware 2018-03-19 19:48:14 +01:00
Daniel García Aubert
bb170ee208 Please, jshint 2018-03-19 19:27:38 +01:00
Daniel García Aubert
8333b39928 Use res.body as placeholder of layergroup 2018-03-19 19:16:18 +01:00
Simon Martín
fefff3b788 version 6.0.0 2018-03-19 15:38:31 +01:00
Simon Martín
d5e985fde5 Merge pull request #875 from CartoDB/rateLimits
Rate limit
2018-03-19 15:36:26 +01:00
Simon Martín
ed27f980c2 NEWS 2018-03-19 15:30:47 +01:00
Simon Martín
b6afad1787 upgrading cartodb-redis 2018-03-19 15:19:08 +01:00
Simon Martín
7807ea5f8c updating docker image 2018-03-19 15:15:38 +01:00
Daniel García Aubert
d463d35906 Remove mocha filter 2018-03-19 14:56:20 +01:00
Daniel García Aubert
5cde325d9a Fix ported test related to cache_buster from layergroup token 2018-03-19 13:51:03 +01:00
Daniel García Aubert
b038763b7b Fix skipped test, port is configured via app configuration. It's no longer configurable via query-params 2018-03-19 12:48:52 +01:00
Daniel García Aubert
aa448a8c2e Remove NO PORTED TEST makefile option 2018-03-19 12:43:47 +01:00
Simon Martín
a830eb4ea0 Merge branch 'master' into rateLimits 2018-03-19 11:25:13 +01:00
Daniel García Aubert
73397ab500 Typo 2018-03-16 20:04:39 +01:00
Daniel García Aubert
a7f6eafd5c Remove unused porperties from ported server options 2018-03-16 20:04:29 +01:00
Daniel García Aubert
ed9083de24 Remove req2params middleware from ported server options 2018-03-16 20:02:18 +01:00
Daniel García Aubert
a2fa92abf1 Fix ported test ny adding host header to the request 2018-03-16 19:58:29 +01:00
Daniel García Aubert
fa1e1fd779 Fix ported test by adding host header to the requests 2018-03-16 19:56:34 +01:00
Daniel García Aubert
adde66bc57 Fix more ported test 2018-03-16 18:59:07 +01:00
Daniel García Aubert
db08fc3da2 Remove meaningless test 2018-03-16 18:58:42 +01:00
Daniel García Aubert
97e603b215 Fix ported test 2018-03-16 18:33:47 +01:00
Daniel García Aubert
29936d76b1 Fix ported test by adding host header to request 2018-03-16 18:18:06 +01:00
Daniel García Aubert
3f88aaae64 Fix ported test by adding host header to requests 2018-03-16 18:15:37 +01:00
Daniel García Aubert
fccf46c67d Add host header to test-client (ported) 2018-03-16 18:06:31 +01:00
Daniel García Aubert
970aca1c9d Add host header to test_client (ported) 2018-03-16 17:55:04 +01:00
Daniel García Aubert
5e494f0982 Add host headers to attributes test (ported) 2018-03-16 17:51:48 +01:00
Daniel García Aubert
91a7dc8cf0 Use const 2018-03-16 17:31:40 +01:00
Daniel García Aubert
e52cd28f1e User res.body as placeholder of the response's body 2018-03-16 17:13:48 +01:00
Daniel García Aubert
7bdbd4cb03 Move variable declaration 2018-03-16 16:42:47 +01:00
Daniel García Aubert
95d694f6c5 Fix unit test 2018-03-16 16:29:00 +01:00
Daniel García Aubert
313fc75ec8 Rename middleware 2018-03-16 16:28:50 +01:00
Daniel García Aubert
639a69a639 Reorder middlewares to optimize workflow 2018-03-16 16:12:36 +01:00
Raúl Marín
a4ec3ad6da Merge pull request #908 from CartoDB/master_analyses_fixes
Update camshaft to 0.61.8
2018-03-16 15:44:10 +01:00
Raul Marin
b7c10c95d3 Update camshaft to 0.61.8 2018-03-16 15:39:20 +01:00
Daniel García Aubert
67d2d2fe95 Use spread operator 2018-03-16 14:20:41 +01:00
Daniel García Aubert
0aa8d63a6e Unifiy allowQueryParams and cleanUpQueryParams middlewares 2018-03-16 14:03:59 +01:00
Daniel García Aubert
7b11cdcb74 Use template string 2018-03-16 13:08:00 +01:00
Daniel García Aubert
071a5a4bdf Rename base paths 2018-03-16 13:04:42 +01:00
Daniel García Aubert
5ede6c3021 Add test suite to not run ported test 2018-03-15 19:38:39 +01:00
Daniel García Aubert
7ff7b0c2d1 Extract rest of the middlewares from prepare contex 2018-03-15 19:38:11 +01:00
Daniel García Aubert
30dab7df9f Extract authorize middeware form prepareContext 2018-03-15 18:48:29 +01:00
Daniel García Aubert
afff06c7e6 Extract db-conn-setup middleware for prepare-context 2018-03-15 15:33:20 +01:00
Simon Martín
05ef43c342 download redis cell with curl and change path 2018-03-15 12:19:06 +01:00
Rafa de la Torre
c235754df2 Stub next version 5.4.1 2018-03-15 12:12:37 +01:00
Rafa de la Torre
70dab149ba Update release date in NEWS.md 2018-03-15 12:11:03 +01:00
Rafa de la Torre
ed4b44a78a Merge pull request #905 from CartoDB/mapnik-3.6.2-carto.4
Upgrade @carto/mapnik to 3.6.2-carto.4
2018-03-15 12:08:32 +01:00
Simon Martín
54f113ab5f download redis-cell lib during tests 2018-03-15 11:35:38 +01:00
Simon Martín
60bf81d950 removing redis-cell file 2018-03-15 11:35:00 +01:00
Simon Martín
bdfd58f468 removing basic redis cell tests file 2018-03-15 11:26:29 +01:00
Rafa de la Torre
de1aaf3808 Update image because of new mapnik cache 2018-03-15 09:55:07 +01:00
Rafa de la Torre
769aee1107 Do not use the @github: notation in yarn.lock
The little advantage is that from a clean dir a `yarn install` won't
modify the `yarn.lock` file.
2018-03-15 09:36:35 +01:00
Rafa de la Torre
3663e6d12a More accurate msg in NEWS.md 2018-03-15 09:33:23 +01:00
Rafa de la Torre
a6d9984453 Upgrade @carto/mapnik to 3.6.2-carto.4 2018-03-15 09:29:08 +01:00
Simon Martín
4e8cf136c8 rate limit middleware before auth 2018-03-14 18:06:06 +01:00
Daniel
f49d7478d7 Merge pull request #899 from CartoDB/refactor-named-maps-admin
Named Maps Admin: Extract middlewares form controller's context
2018-03-14 17:55:03 +01:00
Daniel
b4a1c9d648 Merge pull request #898 from CartoDB/refactor-analysis-controller
Refactor analysis controller
2018-03-14 17:50:15 +01:00
Daniel
692246ec44 Merge pull request #901 from CartoDB/refactor-named-maps-controller
Refactor named maps controller
2018-03-14 17:50:06 +01:00
Simon Martín
48a7d28aa6 rate limit analysis catalog endpoint 2018-03-14 17:46:19 +01:00
Daniel García Aubert
04146f897d Use template strings 2018-03-14 17:33:54 +01:00
Daniel García Aubert
a34658c97f Use objects instead of param list 2018-03-14 17:31:37 +01:00
Simon Martín
cbfeb0158e adding type and subtype to rate limit error 2018-03-14 17:27:59 +01:00
Daniel García Aubert
8d37e00869 Use objects instead of parameter list 2018-03-14 17:25:58 +01:00
Raúl Marín
584d6ae9cf Merge pull request #902 from CartoDB/camshaft0614
Update camshaft to 0.61.4
2018-03-14 17:25:25 +01:00
Daniel García Aubert
421e611356 Use objects instead of a list of parameters 2018-03-14 17:22:47 +01:00
Daniel García Aubert
f078713d28 typo 2018-03-14 17:15:50 +01:00
Daniel García Aubert
a8d31d52cf Pass only required params 2018-03-14 17:08:04 +01:00
Raul Marin
d9213b2fe2 Update camshaft to 0.61.4 2018-03-14 15:56:35 +01:00
Daniel García Aubert
091efe52fc Extract sendResponse middleware from context 2018-03-14 13:32:43 +01:00
Daniel García Aubert
a5c508733a Extract setContentTypeHeader middleware from controller's context 2018-03-14 13:31:39 +01:00
Daniel García Aubert
ce944d9a7d Extract setCacheControlHeader from controller's context 2018-03-14 13:30:27 +01:00
Daniel García Aubert
8321b5adba Extract setLastModifiedHeader from controller's context 2018-03-14 13:27:56 +01:00
Daniel García Aubert
667c972308 Extract setCacheChannelHeader and setSurrogateKeyHeader from controller's context 2018-03-14 13:25:42 +01:00
Daniel García Aubert
3dbe05be3a Extarct setCacheChannelHeader middleware from controller's context 2018-03-14 13:19:56 +01:00
Daniel García Aubert
2d4ce19250 Extract incrementMapViews middleware from controllers middleware 2018-03-14 13:18:37 +01:00
Daniel García Aubert
3b3e0c0acd Extract getImage middleware from controller's context 2018-03-14 13:15:38 +01:00
Daniel García Aubert
c3ddb933bb Extract getStaticImageOptions middleware from controller's context 2018-03-14 13:11:17 +01:00
Daniel García Aubert
6aae60ece7 Extract getTile middleware from controller's context 2018-03-14 13:07:40 +01:00
Daniel García Aubert
6b3dc8ece0 Extract prepareLayerFilterFromPreviewLayers middleware from controller's context 2018-03-14 13:05:05 +01:00
Daniel García Aubert
7dd231a8c9 Extract getTemplate middleware form controller's context 2018-03-14 13:02:49 +01:00
Daniel García Aubert
35a3219012 Extract getAffectedTables middleware from controller's context 2018-03-14 13:01:07 +01:00
Daniel García Aubert
7598e6ab4b Extract getNamedMapProvider middleware from controller's context 2018-03-14 12:58:56 +01:00
Simon Martín
bbedc5f41b Updating headers on tests 2018-03-14 12:15:07 +01:00
Simon Martín
e1a2c45b19 Headers following rfc6648 2018-03-14 12:09:20 +01:00
Simon Martín
8fa801e032 updating config parameters 2018-03-14 11:34:59 +01:00
Raúl Marín
75870dc6c1 Merge pull request #900 from Algunenano/windshaft457
Update Windshaft to 4.5.7
2018-03-14 10:39:05 +01:00
Raul Marin
42900b5d0e Update Windshaft to 4.5.7 2018-03-14 10:28:34 +01:00
Simon Martín
c1423d77ff yarn lock after master merge 2018-03-13 18:10:27 +01:00
Simon Martín
0e43c54214 Merge branch 'master' into rateLimits 2018-03-13 18:09:44 +01:00
Daniel García Aubert
2cc4161239 Missing semicolon 2018-03-13 15:02:44 +01:00
Daniel García Aubert
fc8f3fdf27 Create send response middleware 2018-03-13 13:31:49 +01:00
Daniel García Aubert
24b76208ac Improve naming 2018-03-13 13:21:40 +01:00
Daniel García Aubert
0de272b195 Extract middlewares form controller's context 2018-03-13 13:12:18 +01:00
Daniel
7faf40004c Merge pull request #891 from CartoDB/refactor-map-controler
Refactor map controler
2018-03-13 12:44:53 +01:00
Daniel García Aubert
88ae2d473a Typo 2018-03-13 11:43:08 +01:00
Daniel García Aubert
337b47685c Remove controler context from middlewares 2018-03-13 11:42:25 +01:00
Raúl Marín
ed3f9be655 Merge pull request #897 from Algunenano/windshaft456
Update Windshaft to 4.5.6
2018-03-12 19:21:09 +01:00
Raul Marin
248c6d5f22 Update Windshaft to 4.5.6 2018-03-12 19:13:56 +01:00
Raúl Marín
dd4aa09d21 Merge pull request #896 from Algunenano/master_camshaft0613
Update camshaft to 0.61.3
2018-03-12 17:02:25 +01:00
Raul Marin
132f2226ca Update camshaft to 0.61.3 2018-03-12 16:52:43 +01:00
Daniel
2eb6e95fed Merge pull request #895 from CartoDB/fix-performance-regression
Fix performance regression
2018-03-12 15:48:20 +01:00
Daniel García Aubert
db8130be4f Honor jshint 2018-03-12 14:18:07 +01:00
Daniel García Aubert
379b649e95 Don't get mapconfig prematurely 2018-03-12 13:29:40 +01:00
Raúl Marín
e5619492ef Merge pull request #894 from Algunenano/master_windshaft455
Update Windshaft to 4.5.5
2018-03-12 13:23:15 +01:00
Daniel García Aubert
cc76ccc626 Fix undeclared variable 2018-03-12 13:10:20 +01:00
Raul Marin
3d6512dd11 Update Windshaft to 4.5.5 2018-03-12 13:01:17 +01:00
Eneko Lakasta
b19d97e01f Merge pull request #886 from CartoDB/vary-header
Vary header
2018-03-12 12:46:42 +01:00
Daniel García Aubert
25931a618b Do not calculate affected tables when there are no affacted tables 2018-03-12 12:33:29 +01:00
Eneko Lakasta
ffab576399 Merge branch 'master' into vary-header 2018-03-12 12:31:23 +01:00
Raúl Marín
e7067ab9cf Merge pull request #893 from Algunenano/master_request_update
Update request to 2.85.0
2018-03-12 12:25:19 +01:00
Eneko Lakasta
7cfcf6d579 merge master 2018-03-12 12:16:55 +01:00
Raul Marin
a4b586055a Update request to 2.85.0 2018-03-12 12:16:29 +01:00
Eneko Lakasta
5ad1e1b645 merge master 2018-03-12 11:52:38 +01:00
Daniel García Aubert
01ed513a79 Use 'const' 2018-03-09 17:02:13 +01:00
Daniel García Aubert
504f68b8aa Missing semicolon 2018-03-09 16:18:33 +01:00
Daniel García Aubert
cbb08f5642 Extract function 2018-03-09 15:49:03 +01:00
Raúl Marín
a4b5d681ce Merge pull request #890 from Algunenano/windshaft_454
Update Windshaft to 4.5.4
2018-03-09 13:12:37 +01:00
Daniel García Aubert
02f93f3a14 Extract layergroup-metadata class 2018-03-09 12:58:05 +01:00
Raul Marin
ad2f4573f8 Update Windshaft to 4.5.4 2018-03-09 11:44:42 +01:00
Raúl Marín
06604cd738 Merge pull request #888 from Algunenano/support_1368
Aggregation count: Do not return null categories
2018-03-09 11:06:40 +01:00
Raul Marin
089be35b5d Aggregation count: Do not return null categories 2018-03-08 18:13:20 +01:00
Daniel García Aubert
bbcb335d60 Merge branch 'master' into refactor-map-controler 2018-03-08 13:18:43 +01:00
Daniel
6ef2e0bb5f Merge pull request #887 from CartoDB/middlewarify-layergroup-controller
Middlewarify layergroup controller
2018-03-08 13:04:39 +01:00
Daniel García Aubert
d8202d881d Remove legacy test 2018-03-08 12:46:04 +01:00
Daniel García Aubert
aae814a156 Use template strings 2018-03-08 12:35:54 +01:00
Daniel García Aubert
49bcc5368d Use base number as radix to pare intergers 2018-03-08 12:30:27 +01:00
Daniel García Aubert
555e04f9e7 Use ternary operator 2018-03-08 12:27:49 +01:00
Daniel García Aubert
3f6f2e4e23 Use template string 2018-03-08 12:23:43 +01:00
Daniel García Aubert
abffc4b067 Uppercase for actual constants 2018-03-08 12:23:00 +01:00
Daniel García Aubert
363cb0b679 Extract middlewares from map-controller class 2018-03-08 12:16:24 +01:00
Daniel García Aubert
d26910ba9c Extract checkJsonContentType middleware from MapController class 2018-03-07 19:11:03 +01:00
Daniel García Aubert
74b2f305ea Extract initProfiler middleware from map-controller 2018-03-07 19:09:52 +01:00
Daniel García Aubert
6c2f893651 Rename map-store-map-config-provider middleware 2018-03-07 18:53:20 +01:00
Daniel García Aubert
faaf121eb6 Rename center and bbox middlewares 2018-03-07 18:51:43 +01:00
Daniel García Aubert
83ab65163d Rename attributes middleware 2018-03-07 18:43:35 +01:00
Daniel García Aubert
9dcd5ff332 Impreve naming 2018-03-07 15:56:16 +01:00
Daniel García Aubert
c6635f63c1 Unify layer and tile middlewares 2018-03-07 15:39:59 +01:00
Daniel García Aubert
56213219e4 Rename middleware 2018-03-07 15:25:30 +01:00
Daniel García Aubert
7c2dc20dbe Merge branch 'master' into middlewarify-layergroup-controller 2018-03-07 15:24:34 +01:00
Daniel García Aubert
c8e8317ea4 Do not attach middleware to LayergroupController classs 2018-03-07 15:20:47 +01:00
Daniel
8509796743 Merge pull request #882 from CartoDB/middleware-refactor
Middleware refactor
2018-03-07 15:19:04 +01:00
Daniel García Aubert
90aaed0f2c Typo 2018-03-07 15:05:36 +01:00
Daniel García Aubert
48be15b742 Use const in favour of var 2018-03-07 15:01:04 +01:00
Daniel García Aubert
a95b3f2f99 Fix comment 2018-03-07 14:54:09 +01:00
Daniel García Aubert
b2cc7ab84f Move functions to improve readablity 2018-03-07 14:53:13 +01:00
Daniel García Aubert
eb3414f07f Follow middleware pattern 2018-03-07 14:48:21 +01:00
Daniel García Aubert
292dad130d Move middlewares to the right place 2018-03-07 14:42:21 +01:00
Daniel García Aubert
ec41cddb19 Do not pass the whole res.locals to backends 2018-03-07 12:52:44 +01:00
Daniel García Aubert
5871f8290d Use default param values 2018-03-07 12:46:18 +01:00
Daniel García Aubert
33089be2cd Do not attach header middlewares to node status endpoint 2018-03-07 12:30:59 +01:00
Daniel García Aubert
d351c8d14c Define var as const 2018-03-07 12:09:41 +01:00
Daniel García Aubert
82446e5ffa Use template string to define routes 2018-03-07 12:05:53 +01:00
Daniel García Aubert
b786164e8a Middlewarify metrics increment whether success or error 2018-03-07 11:56:57 +01:00
Eneko Lakasta
f9cbb3aac8 use assert.equal instead of assert.ok 2018-03-07 10:51:17 +01:00
Daniel García Aubert
a66c19c6c7 Do not bind context when unneeded 2018-03-06 20:05:55 +01:00
Daniel García Aubert
94d1667d70 Refactor affected tables 2018-03-06 20:01:43 +01:00
Daniel García Aubert
3399db1cff Add comment 2018-03-06 18:58:09 +01:00
Daniel García Aubert
874ea99d19 Remove step 2018-03-06 18:43:23 +01:00
Daniel García Aubert
7022fb87b4 Extract header, affected-tables and response middlewares 2018-03-06 18:28:40 +01:00
Daniel García Aubert
7c1e2a6af0 Avoid nested steps 2018-03-06 17:08:39 +01:00
Daniel García Aubert
2f011c3266 Remove nested steps 2018-03-06 17:01:51 +01:00
Daniel García Aubert
4762aa0897 Remove step from sendResponse function 2018-03-06 16:55:27 +01:00
Daniel García Aubert
f30f83331f Extract tile error middleware 2018-03-06 16:44:37 +01:00
Daniel García Aubert
3695e1e3e5 Place function closer to where is called 2018-03-06 16:21:46 +01:00
Daniel García Aubert
585b5929aa Middlewarify tile and layer endpoints 2018-03-06 16:19:53 +01:00
Eneko Lakasta
0185cdf785 please jshint 2018-03-06 15:34:29 +01:00
Eneko Lakasta
8d22ca66ba fix tests 2018-03-06 15:26:35 +01:00
Eneko Lakasta
b0eacb2a79 add vary header to honor authorization header when caching 2018-03-06 12:46:38 +01:00
Daniel García Aubert
9b40370794 Now that mapConfigProvider is linked to 'res.locals' do not pass the whole 'res.locals' to map-config-provider to avoid converting circular structure to JSON 2018-03-06 12:44:17 +01:00
Daniel García Aubert
95f3d58383 Make jshint happy 2018-03-05 19:33:46 +01:00
Daniel García Aubert
0f0cde1093 Middlewarify static-api (bbox/center) endpoints 2018-03-05 19:26:26 +01:00
Simon Martín
e679366dac upgrading redis-cell to v2.2 2018-03-05 18:44:55 +01:00
Daniel García Aubert
ca56df5cfe Middlewarify attributes endpoint 2018-03-05 18:28:52 +01:00
Daniel García Aubert
d8a4209768 Middlewarify analysis-node-status endpoint 2018-03-05 18:13:19 +01:00
Daniel García Aubert
40712a2e62 Middlewarify search dataview endpoint 2018-03-05 18:05:42 +01:00
Daniel García Aubert
acb9ce33b1 Pass dataview-backend as middleware option 2018-03-05 18:04:50 +01:00
Daniel García Aubert
5e43a7145a Middlewarify dataview endpoint 2018-03-05 17:44:04 +01:00
Daniel
39bd6694f2 Merge pull request #883 from CartoDB/fix-named-map-format
Do not force format for default named tiles
2018-03-05 11:29:43 +01:00
Daniel García Aubert
5de8c4f9c3 Make explicit that forceFormat is optional 2018-03-05 11:19:17 +01:00
Simon Martín
31a554d94f updating tests to use cartodb-redis 2018-03-03 14:46:58 +01:00
Simon Martín
9bc9fc46ff using cartodb-redis for rate limit 2018-03-03 14:46:39 +01:00
Simon Martín
4274e06795 updating cartodb-redis 2018-03-03 14:45:55 +01:00
Simon Martín
a2bf235553 Merge branch 'master' into rateLimits 2018-03-02 21:21:10 +01:00
Simon Martín
1b18b2b188 changing endpointGroup var name 2018-03-02 20:55:50 +01:00
Simon Martín
9c27447b17 refactoring rate limit tests 2018-03-02 20:52:06 +01:00
Daniel García Aubert
f03d98cd0d Going green: fix test 2018-03-02 18:37:13 +01:00
Daniel García Aubert
6331bebb30 Going green: be able to request defaul named tiles in vector format 2018-03-02 18:25:23 +01:00
Daniel García Aubert
fdd4c4aaa0 Going red: get default named map vector tile 2018-03-02 18:22:53 +01:00
Simon Martín
4dd404771e refactoring user_limits_api 2018-03-02 16:07:42 +01:00
Simon Martín
bf267e9c95 fix checking rate limit enabled 2018-03-02 15:48:31 +01:00
Simon Martín
843f70cdba interchange var and middlewware names 2018-03-02 15:35:38 +01:00
Simon Martín
42e0e07c14 refactoring rate limit middleware 2018-03-02 15:33:50 +01:00
Simon Martín
dfdd2b9043 adding middlewares to composer in maps controller 2018-03-02 15:24:18 +01:00
Daniel García Aubert
8656fcd8d1 Use 'const' 2018-03-02 14:04:29 +01:00
Daniel García Aubert
f2f6b9d49c ES6 goodies 2018-03-02 13:29:30 +01:00
Daniel García Aubert
82f1e6753b Remove unreachable code 2018-03-02 13:14:02 +01:00
Daniel García Aubert
7ed717607a Missing space before paramenter list 2018-03-02 13:08:57 +01:00
Daniel García Aubert
0ec9491d21 Fix test: Add stub for profiling 2018-03-02 11:16:46 +01:00
Daniel García Aubert
416970c819 Remove empty line 2018-03-01 19:10:35 +01:00
Daniel García Aubert
ccc28f3617 Add profiler step to lzma 2018-03-01 19:09:11 +01:00
Daniel García Aubert
5bac36b30f Remove bad profiler usage 2018-03-01 18:53:05 +01:00
Daniel García Aubert
ef3ffddec7 Cosmetic changes 2018-03-01 18:49:44 +01:00
Daniel García Aubert
e6ba467d98 ES6 goodies 2018-03-01 18:47:07 +01:00
Daniel García Aubert
314508bcd8 Middleware naming convention 2018-03-01 18:46:04 +01:00
Daniel García Aubert
da18506e41 Follow middleware factory pattern 2018-03-01 18:45:04 +01:00
Daniel García Aubert
5eaee0b71e Follow middleware naming convention 2018-03-01 18:12:07 +01:00
Daniel García Aubert
bd93e7dc7e Follow middleware pattern 2018-03-01 18:09:49 +01:00
Daniel García Aubert
2c762813ba Follow middleware pattern, return a function as the actual middleware 2018-03-01 15:52:48 +01:00
Simon Martín
136c6fa70b new redis keys 2018-03-01 15:50:40 +01:00
Simon Martín
67b2343571 fix existing var name 2018-03-01 15:50:20 +01:00
Daniel García Aubert
3caa1d9c4a ES6 cosmetics 2018-03-01 15:42:46 +01:00
Daniel García Aubert
b0c924ca03 Follow middleware pattern, should return a function as the actual middleware 2018-03-01 15:42:03 +01:00
Daniel García Aubert
f6f59023b4 Ungroup middlewares 2018-02-28 19:46:46 +01:00
Daniel García Aubert
9dc4e7c955 Use the right step name for profiling 2018-02-28 19:29:53 +01:00
Daniel García Aubert
faa44e54ae Cosmetic changes 2018-02-28 19:29:10 +01:00
Daniel García Aubert
bfb743b851 Improve profiling steps 2018-02-28 19:27:49 +01:00
Daniel García Aubert
dad2e92dd3 Follow middleware naming convention 2018-02-28 19:26:47 +01:00
Daniel García Aubert
59c312ea40 Require modules at the beginning of module 2018-02-28 19:25:50 +01:00
Daniel García Aubert
48c5a458f3 Remove bad use of profiling step 2018-02-28 19:22:22 +01:00
Daniel García Aubert
c0830862c8 Follow middleware naming convention 2018-02-28 19:21:44 +01:00
Daniel García Aubert
42deb7abbe Rename middleware 2018-02-28 19:20:51 +01:00
Daniel García Aubert
62deda6470 Improve naming 2018-02-28 19:13:49 +01:00
Daniel García Aubert
3e0981978a Update NEWS 2018-02-28 17:31:03 +01:00
Eneko Lakasta
35e5170907 Merge pull request #877 from CartoDB/project-auth-api
Auth API
2018-02-28 17:20:21 +01:00
Eneko Lakasta
8eba5dcc01 update cartodb-redis to 0.16.0 2018-02-28 17:07:31 +01:00
Daniel García Aubert
5c2248d419 Merge branch 'master' into project-auth-api 2018-02-28 14:43:12 +01:00
Simon Martín
335d91b42d separate rate limit logic from middleware and EVALSHA 2018-02-28 13:11:18 +01:00
Daniel García Aubert
102b11b1b5 Follow middleware naming convention 2018-02-28 13:10:46 +01:00
Eneko Lakasta
26df09b13f require debug at the top of file 2018-02-28 11:42:44 +01:00
csubira
9259d04771 Remove routes md 2018-02-28 11:22:23 +01:00
Simon Martín
254991c56c changing endpoint groups constant keys 2018-02-27 17:57:25 +01:00
Simon Martín
a492ab0143 improving naming 2018-02-27 17:36:03 +01:00
Simon Martín
b0d63b2ec0 changing module exports and middleware name 2018-02-27 16:52:27 +01:00
Simon Martín
85b0c63eb0 destructuring array assignment 2018-02-27 16:24:30 +01:00
Simon Martín
98a92f51e6 make jshint happy 2018-02-26 17:17:01 +01:00
Simon Martín
ae50dbd47c updating test to own redis-cell 2018-02-26 17:03:56 +01:00
Simon Martín
a97e628520 using own version of redis-cell 2018-02-26 16:27:07 +01:00
Simon Martín
b48dcc1418 moving tests to right folder type 2018-02-26 16:23:42 +01:00
Eneko Lakasta
8867cdbc02 use anonymous function instead of arrow function in middleware export to don't bind this 2018-02-26 15:57:42 +01:00
Simon Martín
f03ee4b836 removing hardcoded user 2018-02-26 11:20:31 +01:00
Simon Martín
90418b204e getLowerRateLimit tests 2018-02-26 10:51:51 +01:00
Simon Martín
918674e01a changing endpoint groups names 2018-02-23 21:09:27 +01:00
Simon Martín
7b44b7d559 removing only 2018-02-23 21:09:03 +01:00
Simon Martín
612b11cbe8 rate limit tests ensuring the smaller limit 2018-02-23 21:07:25 +01:00
Simon Martín
b34f05690c updating rate limit tests supporting multiple limits 2018-02-23 17:42:54 +01:00
Simon Martín
9b01a05727 rate limit supporting multiple limits 2018-02-23 17:42:24 +01:00
Simon Martín
d0024409df removing tests of redis-cell 2018-02-23 16:23:59 +01:00
Simon Martín
91856372f0 adding redis-cell test file. Remove it before PR merge 2018-02-23 16:16:34 +01:00
csubira
b1fb838b19 Add new structure to docs folder 2018-02-21 19:22:02 +01:00
Simon Martín
2937b6a804 updating redis keys 2018-02-21 17:25:26 +01:00
Simon Martín
b76a8249fa fix overwritten environment params 2018-02-21 11:37:20 +01:00
Simon Martín
db09476137 adding test_helper to have environment params 2018-02-21 11:35:41 +01:00
Simon Martín
08a5e57180 new config params and using them in middleware 2018-02-20 18:18:15 +01:00
Simon Martín
7464d827fe using the new config params 2018-02-20 18:17:25 +01:00
Simon Martín
ae0ec159e1 changing config params to more semantics 2018-02-20 18:16:51 +01:00
Simon Martín
2a1c08da65 ensuring configuration params in tests 2018-02-20 17:58:08 +01:00
Simon Martín
faab174a79 redis keys in easier way 2018-02-20 17:19:50 +01:00
Eneko Lakasta
521b441da5 default apikey is returned by metadata module if no apikey found, remove this code because is never going to be run 2018-02-20 12:53:33 +01:00
Eneko Lakasta
59ca00b33b move apikey credentials getter to middleware file 2018-02-20 12:31:36 +01:00
Simon Martín
6564ed69d8 config params 2018-02-20 11:46:38 +01:00
Simon Martín
fadd9032c6 arrow functions clean 2018-02-20 11:38:44 +01:00
Simon Martín
80918f5b9b adding rate limit middlewware to named maps controller 2018-02-20 11:26:24 +01:00
Simon Martín
e061b3e631 adding rate limit middlewware to maps controller 2018-02-20 11:26:09 +01:00
Simon Martín
06ec3f80b9 adding rate limit middlewware to named maps admin controller 2018-02-20 11:25:56 +01:00
Simon Martín
e6011287f4 adding middleware to layergroup controller 2018-02-20 11:25:16 +01:00
Simon Martín
a0f560ca1a rate limits acceptance tests 2018-02-20 10:57:29 +01:00
Daniel García Aubert
7c7d606aa7 Remove trailing spaces 2018-02-19 19:05:13 +01:00
Daniel
46587e3cf1 Merge pull request #874 from CartoDB/project-auth-api-fallback
add fallback for using metadata fallback
2018-02-19 18:55:24 +01:00
Daniel García Aubert
603ef4044c Reduce cyclomatic complexity 2018-02-19 18:48:02 +01:00
Daniel García Aubert
2e3abfb2cd Catch "name not found" errors from metadata backend and set http code status 404 2018-02-19 18:28:58 +01:00
Daniel García Aubert
47ccb7ded8 Point to main development branch of cartodb-redis 2018-02-19 17:57:46 +01:00
Simon Martín
98907a886c using a real endpoint in test 2018-02-19 17:08:26 +01:00
Eneko Lakasta
7e14247ea9 remove cause of unreachable code/dead code. Not necessary because carto redis assures at least the default api key 2018-02-19 17:06:59 +01:00
Simon Martín
e103427750 removing forgotten .only 2018-02-19 17:06:00 +01:00
Simon Martín
95f55b00b3 using exported const in tests 2018-02-19 17:03:03 +01:00
Simon Martín
e519984790 changing const names and exporting them 2018-02-19 17:01:41 +01:00
Simon Martín
fa3223777f using new docker image with redis4 and redis-cell 2018-02-19 12:43:36 +01:00
Simon Martín
eeb4966294 make jshint happy 2018-02-19 12:42:42 +01:00
Eneko Lakasta
5823859b2a update package.json to use the same branch form carto redis 2018-02-16 12:00:05 +01:00
Eneko Lakasta
7b21bd26d0 Merge branch 'project-auth-api' into project-auth-api-fallback 2018-02-16 11:29:36 +01:00
Eneko Lakasta
4ac224688c in fallback mode, use default api key if api key token doesnt exist 2018-02-16 11:20:04 +01:00
Simon Martín
4742e7f64f skiping some tests 2018-02-16 09:06:14 +01:00
Simon Martín
a66f127828 adding some tests 2018-02-15 20:06:34 +01:00
Eneko Lakasta
e84d88b7a3 remove test 2018-02-15 17:53:15 +01:00
Eneko Lakasta
cda2616a8a get and check api key credentials from api key: username and token 2018-02-15 17:49:47 +01:00
Eneko Lakasta
11aa4d12bd add tests for getting api key token from requests 2018-02-15 15:27:41 +01:00
Eneko Lakasta
18dbeea003 get apikey token from request in named maps admin middleware 2018-02-15 15:20:52 +01:00
Eneko Lakasta
3e916c6054 check if req.query exist before getting req.query.api_key/map_key 2018-02-15 15:20:05 +01:00
Eneko Lakasta
fc420c2c0f use for compatibility res.locals.api_key instead of res.locals.apikeyToken 2018-02-15 15:19:09 +01:00
Simon Martín
7b9d653c46 rate limit tests structure 2018-02-15 13:33:32 +01:00
Eneko Lakasta
140441b777 fix test 2018-02-15 12:53:01 +01:00
Eneko Lakasta
5db0e9c8d8 add middleware for apikeyToken 2018-02-15 12:50:42 +01:00
Simon Martín
63d1c19263 validation in lua script 2018-02-15 12:44:27 +01:00
Simon Martín
018cd25593 adding redis-cell to tests 2018-02-15 12:42:37 +01:00
Eneko Lakasta
963737d3fb create lib for getting api key token from request 2018-02-15 11:36:42 +01:00
Simon Martín
c059f44bf1 lua script and rate limit process 2018-02-14 18:39:57 +01:00
Eneko Lakasta
890f0d1ef6 add fallback for using metadata fallback 2018-02-14 17:31:05 +01:00
Simon Martín
5fca005a3f Merge branch 'master' into rateLimits 2018-02-14 15:40:50 +01:00
Simon Martín
86d4f8e219 lua script v1 2018-02-14 15:40:12 +01:00
Raul Marin
6b0ab45e63 Update Windshaft to 4.5.3 2018-02-13 12:09:59 +01:00
Rafa de la Torre
0b475ab5e2 Stub next version 2018-02-13 09:07:48 +01:00
Rafa de la Torre
97972ac73f Update NEWS.md with v5.3.1 2018-02-13 09:05:06 +01:00
Rafa de la Torre
c3b38b2f60 Merge pull request #865 from CartoDB/perf-boost-agg-dataview
Improve the speed of the aggregation dataview
2018-02-13 09:04:00 +01:00
Rafa de la Torre
b4e06ec1ac Update NEWS.md and stub version 2018-02-12 19:35:34 +01:00
Rafa de la Torre
d0a8bd428f Merge remote-tracking branch 'origin/master' into perf-boost-agg-dataview 2018-02-12 19:33:35 +01:00
Rafa de la Torre
251fe96509 Cosmetic fix, as suggested in PR 2018-02-12 19:24:53 +01:00
Simon Martín
15bf74f770 starting rate limit middleware 2018-02-12 17:19:08 +01:00
Eneko Lakasta
32986e3ebd Merge branch 'master' into project-auth-api 2018-02-12 12:25:46 +01:00
Eneko Lakasta
f106f27df4 Merge branch 'master' into project-auth-api 2018-02-12 12:21:09 +01:00
Raul Marin
3539b658fb Update Windshaft to 4.5.2 2018-02-12 12:19:36 +01:00
Javier Goizueta
abf33a1c68 Release 5.3.0 2018-02-12 12:03:02 +01:00
Javier Goizueta
fc6790ea1e Merge pull request #866 from CartoDB/update-camshaft-to-0.61.2
Update camshaft to 0.61.2
2018-02-12 11:56:31 +01:00
Raul Marin
ac6f0e1c67 Update Windshaft to 4.5.1 2018-02-12 11:35:46 +01:00
Eneko Lakasta
041cd40ec2 please jshint 2018-02-09 19:26:52 +01:00
Eneko Lakasta
8721f56269 add auth test for getting tiles 2018-02-09 19:19:18 +01:00
Eneko Lakasta
1d3045c799 add tests should create/fail creating named maps and regular api key 2018-02-09 12:33:33 +01:00
Daniel García Aubert
52a1ed869c Update to development version of cartodb-redis 2018-02-08 19:28:43 +01:00
Eneko Lakasta
04f60baec5 Set the master role inheritance from regular roles as TBA 2018-02-08 19:01:58 +01:00
Eneko Lakasta
a8de436424 add test should create a layergroup with a buffer analysis using a regular apikey token AND grant privileges to master and regular roles in bootstraping sql 2018-02-08 18:54:14 +01:00
Javier Goizueta
ee7917676b Update camshaft to 0.61.2
This is to fixe a bug in the line-sequential analyses (length was incorrect)
2018-02-08 17:00:13 +01:00
Eneko Lakasta
c7780e9f42 add tests should create a layergroup with a source analysis 2018-02-08 15:20:43 +01:00
Eneko Lakasta
3edd7b8b01 add test should create a layergroup with default apikey token 2018-02-08 14:50:17 +01:00
Eneko Lakasta
455202cd1a organize prepare db api keys 2018-02-08 14:49:42 +01:00
Eneko Lakasta
8bdb82c7be add test should fail creating a layergroup with default apikey token 2018-02-08 14:48:00 +01:00
Eneko Lakasta
fa503ee66a fix test typo 2018-02-08 14:43:12 +01:00
Eneko Lakasta
e1a2ee2381 control API access grants 2018-02-08 13:07:25 +01:00
Eneko Lakasta
b82d26527a remove comment 2018-02-08 12:35:44 +01:00
Eneko Lakasta
1c50dd6b48 add first tests for auth 2018-02-08 12:34:24 +01:00
Eneko Lakasta
b0e9df1400 add pgConnection.getDatabaseParams 2018-02-08 12:04:03 +01:00
Eneko Lakasta
6ebf51ce45 let select apikey type in setDBAuth: regular, default, master 2018-02-08 11:29:17 +01:00
Eneko Lakasta
d9a34f3384 add cartodb250user api keys to redis 2018-02-08 11:13:21 +01:00
Eneko Lakasta
8136a1e136 fix test 2018-02-07 19:12:26 +01:00
Eneko Lakasta
41f3606572 return unauthorized error when api key not found 2018-02-07 19:12:14 +01:00
Eneko Lakasta
ea0542dcb1 remove use of step 2018-02-07 18:48:59 +01:00
Eneko Lakasta
a4dbc1bac2 remove step and check existance of proper api key 2018-02-07 18:20:56 +01:00
Rafa de la Torre
065f56e161 Improve the speed of the aggregation dataview
Improve the performance of the aggregation dataview.

Instead of using a CTE (WITH) for filtered_source, which is only used in
one place to calculate ranks, inject it as a subquery.

This way the planner has a chance to ignore uneeded columns as well as
to parallelize the exectution of the window function (WindowAgg in the
query plan).

That is the part that takes most of the time of the query.

The improvement is about 20-40% in speed on PG10 with 4 cores.
2018-02-07 18:10:13 +01:00
Eneko Lakasta
6b5d6648de fix unit test 2018-02-07 17:14:46 +01:00
Eneko Lakasta
95538707c9 add parameter asMaster to setDBAuth 2018-02-07 17:14:13 +01:00
Eneko Lakasta
4c76a921b1 use res.locals instead of req.params 2018-02-07 16:02:13 +01:00
Eneko Lakasta
85c1c987af refactor setDBConn to not use step 2018-02-07 15:49:32 +01:00
Eneko Lakasta
bde86323fd use master api key in setDBAuth 2018-02-07 15:36:24 +01:00
Eneko Lakasta
880e3f388d remove use of _.extend calls 2018-02-07 12:46:10 +01:00
Eneko Lakasta
c1535b1a12 refactor setDBAuth to not use step 2018-02-07 12:40:36 +01:00
Eneko Lakasta
232ff1ba33 add apikeys keys to be removed after each test 2018-02-07 11:59:00 +01:00
Eneko Lakasta
1b63dcd4e5 add api keys to prepare db for testing 2018-02-07 11:10:50 +01:00
Raúl Marín
b32a0a6547 Merge pull request #864 from Algunenano/master_metrics
Add metrics option to Mapnik renderer (off by default)
2018-02-06 16:48:22 +01:00
Raul Marin
d634be0c30 Update NEWs and Windshaft to 4.5.0 2018-02-06 16:10:44 +01:00
Raul Marin
f9fe3ace37 Add mapnik metrics option 2018-02-06 16:07:22 +01:00
Simon Martín
6cd8131888 updating NEWS 2018-02-06 11:30:34 +01:00
Simon Martín
0ea76f7d15 Merge pull request #849 from CartoDB/redis4
Redis4 support
2018-02-06 11:24:02 +01:00
Simon Martín
51e5b5c255 upgrading cartodb-redis, redis-mpool and windshaft versions 2018-02-05 18:09:14 +01:00
Simon Martín
cedcc094e6 Merge branch 'master' into redis4 2018-02-05 12:42:59 +01:00
Simon Martín
47c8e828df removing raster image on timeout error 2018-02-02 16:38:47 +01:00
Javier Goizueta
bbe8d4e820 Stub next version 2018-02-01 16:39:43 +01:00
Javier Goizueta
5aa98c4ab2 Release 5.2.1 2018-02-01 16:37:05 +01:00
Javier Goizueta
d6a9103779 Merge pull request #861 from CartoDB/860-aggregation-min-res
Limit the minimum size of the the aggregation grid
2018-02-01 16:32:35 +01:00
Javier Goizueta
2e7784ddf2 Add comment to clafify aggregation resolution limit 2018-02-01 10:26:52 +01:00
Raul Marin
086be461b2 Stub next version 2018-02-01 09:33:18 +01:00
Raul Marin
a7157532f1 Release 5.2.0 2018-02-01 09:31:46 +01:00
Raúl Marín
55fd660d69 Merge pull request #859 from Algunenano/master_cache_features
Add Mapnik 'cache-features' option
2018-02-01 09:27:07 +01:00
Javier Goizueta
80604b739a Add test for aggregation with attributes
This reveals #860
2018-01-31 18:56:24 +01:00
Javier Goizueta
d88fbbaa87 Use camelCase 2018-01-31 18:55:28 +01:00
Javier Goizueta
7db0744f67 Simplify expression 2018-01-31 17:54:40 +01:00
Javier Goizueta
d1fcd797a3 Limit the minimum size of the the aggregation grid
Fixes #860
2018-01-31 17:46:13 +01:00
Raul Marin
150c6ee4be Update to Windshaft 5.3.3 2018-01-31 17:24:15 +01:00
Raul Marin
d0df8b1533 Update yarn.lock 2018-01-31 15:40:23 +01:00
Raul Marin
43e1de31fa Add Mapnik 'cache-features' option 2018-01-31 12:18:28 +01:00
Rafa de la Torre
33ed9ab47d Stub next version 2018-01-30 10:16:08 +01:00
Rafa de la Torre
749a08336a Merge pull request #857 from CartoDB/upgrade-to-mapnik-3.6.2-carto.2
Upgrade to node mapnik 3.6.2-carto.2
2018-01-30 10:13:15 +01:00
Rafa de la Torre
467097b3cc Merge remote-tracking branch 'origin/master' into upgrade-to-mapnik-3.6.2-carto.2 2018-01-30 10:07:01 +01:00
Javier Goizueta
487aca52d0 Stub next version 2018-01-29 18:25:14 +01:00
Javier Goizueta
072956addd Release 5.0.1 2018-01-29 18:16:30 +01:00
Rafa de la Torre
781d2d3a28 Update NEWS.md 2018-01-29 17:41:46 +01:00
Rafa de la Torre
2a767cdb83 Update yarn.lock 2018-01-29 17:40:49 +01:00
Rafa de la Torre
e3cf69ac1a Bump windshaft version
That version contains our flavor of mapnik 3.0.15 with a bunch of
patches. See
https://github.com/CartoDB/Windshaft/blob/master/NEWS.md#version-431
2018-01-29 17:40:17 +01:00
Javier Goizueta
27b5420358 Merge pull request #856 from CartoDB/841-the_geom_webmercator-type
Check the type of the_geom_webmercator for aggregation
2018-01-29 16:13:19 +01:00
Javier Goizueta
7641542e67 Check the type of the_geom_webmercator for aggregation
Fixes #841
2018-01-29 15:48:35 +01:00
Javier Goizueta
debb174af4 Add test for aggregation without the_geom
Only the_geom_webmercator is required for aggregation
See #841
2018-01-29 15:44:24 +01:00
Eneko Lakasta
2bd4c9e814 Merge pull request #851 from CartoDB/1259-category-widget-error-group-by-missing
use original column name in group by instead of alias
2018-01-29 15:38:07 +01:00
Simon Martín
0dc7872256 stubs next version 2018-01-29 15:26:41 +01:00
Simon Martín
1e56ba1de9 Merge pull request #854 from CartoDB/respect-types-aggreagation
Respect category type of aggregation dataview
2018-01-29 15:24:38 +01:00
Simon Martín
6f4e338dcb version 5.0.0 2018-01-29 15:19:07 +01:00
Eneko Lakasta
941ebf7d80 Merge branch 'master' into 1259-category-widget-error-group-by-missing 2018-01-29 14:51:59 +01:00
Simon Martín
c38bf6ade8 Merge branch 'master' into respect-types-aggreagation 2018-01-29 14:51:20 +01:00
Javier Goizueta
44c4db93da Merge pull request #855 from CartoDB/846-fix-point-grid
Add cartodb_id to point-grid aggregations
2018-01-29 14:48:17 +01:00
Javier Goizueta
f644b3a226 Add cartodb_id to point-grid aggregation
Fixes #846
2018-01-29 12:49:27 +01:00
Javier Goizueta
7c9b4b7283 Add test to check that cartodb_id is preseent in aggregations
See #846
This revealss that point-grid aggregation is missing cartodb_id
2018-01-29 12:40:59 +01:00
Simon Martín
8c839e214d changing the value of string 2018-01-26 15:44:21 +01:00
Simon Martín
99421b613c moving 'other' outside of the query allowing queries of different types 2018-01-26 15:24:21 +01:00
Simon Martín
bc7a556297 removing category cast to string in aggregation 2018-01-26 12:37:10 +01:00
Simon Martín
2c703e5c16 updating node-redis-mpool dev version 2018-01-19 14:40:27 +01:00
Eneko Lakasta
220f1d6a73 use original column name in group by instead of alias 2018-01-18 15:27:54 +01:00
Simon Martín
e68ba95fed adding cartodb-redis with redis4 support 2018-01-18 15:16:40 +01:00
Simon Martín
83d00a8aca Merge branch 'master' into redis4 2018-01-17 10:29:32 +01:00
Daniel
767dde0b1e Merge pull request #850 from CartoDB/fix-named-map-force-all-layer
Fix named map regression: default to all layer
2018-01-16 19:22:56 +01:00
Daniel García Aubert
da32d96607 Fix regression: default to all layers if layer filter is not provided 2018-01-16 17:57:22 +01:00
Daniel García Aubert
76da828168 Use error label as middleware argument 2018-01-16 17:55:09 +01:00
Simon Martín
479e8970a1 Merge branch 'master' into redis4 2018-01-16 15:10:08 +01:00
Simon Martín
068c242148 Merge pull request #848 from CartoDB/removing-windshaft-carto-testing-image
Removing docker windshaft-carto-testing image
2018-01-16 15:00:34 +01:00
Simon Martín
e4c409f9a5 removing docker windshaft-carto-testing image 2018-01-16 13:01:32 +01:00
Simon Martín
00ffd75781 removing docker-publish command 2018-01-16 12:59:13 +01:00
Simon Martín
cf5e797f90 supporting redis4 2018-01-16 11:59:23 +01:00
Daniel
128ab53c55 Merge pull request #847 from CartoDB/fix-res-locals-named-maps
Do not pass the entire res.locals to named maps provider cache
2018-01-15 19:02:01 +01:00
Daniel García Aubert
ce4050e3e3 Extrac method to get only user params 2018-01-15 18:09:54 +01:00
Daniel García Aubert
b82767c60d Pass a copy of res.locals w/o new data boud to named-map-provider-cache 2018-01-15 17:40:34 +01:00
Raul Marin
0fdab08600 Torque boundaries tests: Sort objects before comparison
Order is not guaranteed by torque and changed behaviour from PG 9.5 to 10
2018-01-15 16:44:10 +01:00
Javier Goizueta
4ba2632a92 Merge pull request #839 from CartoDB/mapconfig-aggregation-spec
Aggregation documetation
2018-01-12 15:04:45 +01:00
Raul Ochoa
d9e66c5964 Link to overviews doc 2018-01-11 15:15:33 +00:00
Raul Ochoa
72bebf1960 Fix typo 2018-01-11 15:15:25 +00:00
Eneko Lakasta
3fa2869665 Merge pull request #840 from CartoDB/984-ICU-dat-not-loading
984 icu dat not loading
2018-01-11 15:22:42 +01:00
Raul Ochoa
e57c4c824b fix invalid json 2018-01-11 11:45:44 +00:00
Eneko Lakasta
8e68e5395d remove .only from test 2018-01-11 12:23:16 +01:00
Eneko Lakasta
0236935212 please jshint 2018-01-11 12:22:51 +01:00
Eneko Lakasta
86e20b4b26 recreate test images with new font 2018-01-11 12:15:23 +01:00
Eneko Lakasta
86d58fea7b use DejaVu Sans Book instead of Open Sans Italic in test 2018-01-11 12:09:04 +01:00
Eneko Lakasta
9934d69736 adjust test image tolerance 2018-01-11 11:57:36 +01:00
Eneko Lakasta
ae48a01e26 extract setICUEnvVariable() to it's own module 2018-01-11 11:57:11 +01:00
Eneko Lakasta
4d11403be2 console.log error in test. For testing purposes only. 2018-01-11 10:49:46 +01:00
Eneko Lakasta
bcd14e4f77 add test to check that labels are wrapped 2018-01-10 22:20:19 +01:00
Eneko Lakasta
60d2cc0a4f set ICU_DATA env variable also in tests 2018-01-10 21:06:47 +01:00
Eneko Lakasta
5e53920aae move glob require to the beginning of the file 2018-01-10 16:27:51 +01:00
Eneko Lakasta
9c556964e5 use glob module to get the icu_data directory 2018-01-10 15:15:43 +01:00
Eneko Lakasta
d292a922f6 set ICU_DATA 3 alternatives 2018-01-10 14:51:48 +01:00
Eneko Lakasta
c016175a23 please jshint 2018-01-10 11:24:08 +01:00
Eneko Lakasta
1b85951e06 Merge branch 'master' into 984-ICU-dat-not-loading 2018-01-10 11:19:29 +01:00
Eneko Lakasta
a4e98163fb set ICU_DATA env variable at app bootstrap 2018-01-10 11:13:49 +01:00
Javier Goizueta
99324b15ef Remove placement examples 2018-01-09 15:58:20 +01:00
Javier Goizueta
e34410fd2c Add references to general aggregation documentation in MapConfig spec 2018-01-09 15:08:46 +01:00
Javier Goizueta
cef7545c17 Add documentation section for aggregation 2018-01-09 14:51:55 +01:00
Javier Goizueta
de8ed27207 Document the tilejon and url metadata. 2018-01-09 14:51:37 +01:00
Javier Goizueta
0cfb204c04 Add MapConfig extension for aggregation 2018-01-09 14:49:33 +01:00
Daniel
fc82ca7490 Merge pull request #834 from CartoDB/middlewarify-named-maps-controller
Middlewarify named maps controller
2018-01-09 11:40:59 +01:00
Daniel García Aubert
183c8291bc Use arrow functions when it applies 2018-01-09 11:20:20 +01:00
Daniel García Aubert
d908ffdbca Don't use arrow functions when there is no needed 2018-01-09 11:17:07 +01:00
Raul Ochoa
00a4f481f6 stubs next version 2018-01-04 02:04:48 +00:00
Raul Ochoa
e0bd042bde Release 4.8.0 2018-01-04 02:04:04 +00:00
Raul Ochoa
f881efdc11 Update news 2018-01-04 02:03:28 +00:00
Raul Ochoa
bda5022811 Merge pull request #838 from CartoDB/url-template-metadata
Add urlTemplate URLs to metadata
2018-01-04 00:44:10 +01:00
Raul Ochoa
d5b5ef584d Be explicit about requesting urlTemplate+subdomains format 2018-01-03 23:33:59 +00:00
Raul Ochoa
2cda43dc8d Promote https urls over http 2018-01-03 22:18:59 +00:00
Raul Ochoa
f7f513a61a Add urlTemplate URLs to metadata
This is useful when using client libraries like leaflet.
2018-01-03 20:53:03 +00:00
Raul Ochoa
940c982b68 Stubs next version 2018-01-03 19:22:38 +00:00
Raul Ochoa
d949d1c27f Release 4.7.0 2018-01-03 19:18:39 +00:00
Raul Ochoa
aa1d411fb8 Update news and bump version 2018-01-03 19:17:58 +00:00
Raul Ochoa
f297374449 Merge pull request #837 from CartoDB/tilejson
Return tilejson in metadata
2018-01-03 20:13:44 +01:00
Raul Ochoa
060b93c314 Rename middleware fn name 2018-01-03 18:44:10 +00:00
Raul Ochoa
3ceeaedf02 Fix test after breaking it with linting changes 2018-01-03 16:19:14 +00:00
Raul Ochoa
c6ba9e6102 Fix linting 2018-01-03 16:10:09 +00:00
Raul Ochoa
bf40b240d3 Return tilejson in metadata
It returns tilejson for each individual layer and also for all vector and raster layers.
2018-01-03 16:54:45 +01:00
Raul Ochoa
5d4d2bddd6 Implementation for getTilesUrls
This will be useful for generating the tilejson in the metadata
2018-01-03 16:05:19 +01:00
Raul Ochoa
95dfd87c96 Add test cases for getTilesUrls 2018-01-03 16:04:31 +01:00
Raul Ochoa
eab9e8846e Reorg suite to accommodate getTileURLs 2018-01-03 12:57:01 +00:00
Daniel
788bc302a0 Merge pull request #833 from CartoDB/middlewarify-named-map-admin-controller
Middlewarify named map admin controller
2018-01-03 13:20:14 +01:00
Daniel García Aubert
1ba240d099 Rename middleware function 2018-01-03 13:15:11 +01:00
Daniel
ee0405da1e Merge pull request #836 from CartoDB/disable-default-aggregation
Add test to check layer aggregation disabling
2018-01-03 13:09:31 +01:00
Daniel
5e9b326d03 Merge pull request #835 from CartoDB/skip-polygon-layer-vector-map-config
In vector-only map-config, only aggregate layers with points
2018-01-03 13:09:07 +01:00
Daniel García Aubert
1f30367e59 Add test to check layer aggregation disabling 2018-01-03 12:40:00 +01:00
Daniel García Aubert
26a2f73c2a Update NEWS 2018-01-03 12:30:46 +01:00
Daniel García Aubert
60005e2f7f Fix bad assertion 2018-01-03 12:24:07 +01:00
Daniel García Aubert
1c7da2c4b3 Going green: do not fail when map-config is vector-only and a layer doesn't have points 2018-01-03 12:00:25 +01:00
Daniel García Aubert
3799dd2574 Going red: fail when vector only map-config has a polygon layer 2018-01-03 11:14:20 +01:00
Raul Ochoa
7efb2a2344 Stubs next version 2018-01-02 15:40:54 +00:00
Raul Ochoa
88777abc2c Release 4.6.0 2018-01-02 15:40:10 +00:00
Raul Ochoa
4d9a6f8fbe update news 2018-01-02 15:39:37 +00:00
Daniel
3d9c2e66c5 Merge pull request #830 from CartoDB/pg-mvt-do-not-filter-columns
Aggregation: be able to return a complete row sample as default aggregation
2018-01-02 15:36:08 +01:00
Daniel García Aubert
6bbe715aa6 Update NEWS 2018-01-02 12:57:54 +01:00
Daniel García Aubert
ba002fdb2c Update windshaft to 4.20 2018-01-02 12:38:58 +01:00
Daniel García Aubert
49c97e2cf2 Use default argument 2018-01-02 10:56:45 +01:00
Daniel García Aubert
41e65a9633 Remove max cyclomatic complexity 2018-01-01 18:06:56 +01:00
Daniel García Aubert
feae766e62 Create middleware to fetch named map template 2018-01-01 16:54:35 +01:00
Daniel García Aubert
e3bdeec8ca Simplify middleware 2018-01-01 16:21:22 +01:00
Daniel García Aubert
80c4207c74 Remove underscore dependencie 2017-12-30 18:18:37 +01:00
Daniel García Aubert
80e4306fbc Remove step and assert dependencies 2017-12-30 18:03:26 +01:00
Daniel García Aubert
543d257a20 Move sendResponse to a middleware 2017-12-30 17:18:12 +01:00
Daniel García Aubert
8a023e3d2f Keep error label 2017-12-30 16:08:46 +01:00
Daniel García Aubert
f13b45862d Move incrementMapViews to a middlewares 2017-12-30 16:04:24 +01:00
Daniel García Aubert
731fe4c00f Move getStaticImageOptions and getImage to a middlewares 2017-12-30 15:21:20 +01:00
Daniel García Aubert
500cbb959f Move method to a middleware 2017-12-30 14:13:23 +01:00
Daniel García Aubert
108a319143 Do not use step 2017-12-29 19:33:49 +01:00
Daniel García Aubert
ef5ea5b4cb Create and use getNamedMapProvider middleware 2017-12-29 19:31:02 +01:00
Raul Ochoa
10d1381e51 Merge remote-tracking branch 'origin/master' into pg-mvt-do-not-filter-columns 2017-12-29 17:50:09 +00:00
Daniel García Aubert
dfef7ff3c0 Use spread assignment 2017-12-29 18:45:45 +01:00
Daniel García Aubert
83d0ce4040 Rename method 2017-12-29 18:25:08 +01:00
Daniel García Aubert
75f72c4d07 Return empty aggregation configuration when the map-config is vector-only and the layer has no aggregation 2017-12-29 17:52:28 +01:00
Daniel García Aubert
adb9e55fb2 Avoid snake_case notation 2017-12-29 16:30:42 +01:00
Daniel García Aubert
5d3726de44 Use original variable name 2017-12-29 16:24:38 +01:00
Daniel García Aubert
f186e4736b Use template string 2017-12-29 16:19:00 +01:00
Daniel García Aubert
a00c2b1eef Now main middlewares return a named function with the right context bound 2017-12-29 16:15:48 +01:00
Daniel García Aubert
64d601179d Use const instead of var 2017-12-29 15:22:17 +01:00
Daniel García Aubert
cf2b73e473 Move to up intermediate middlewares 2017-12-29 15:19:52 +01:00
Daniel García Aubert
70932c23df Remove step and assert dependencies 2017-12-29 15:17:29 +01:00
Daniel García Aubert
519d49bd10 Remove finish function and respond in the main middleware 2017-12-29 15:04:44 +01:00
Daniel García Aubert
bf814c4442 keep error label 2017-12-29 13:05:01 +01:00
Daniel García Aubert
f136993c50 Use checkContentType middleware 2017-12-29 12:44:56 +01:00
Daniel García Aubert
ba008ab518 Remove unused function 2017-12-29 12:36:56 +01:00
Daniel García Aubert
e4ed6ee1cc Use authorizedByAPIKey middleware 2017-12-29 12:34:50 +01:00
Daniel García Aubert
fda7661dad Create authorizedByAPIKey middleware 2017-12-29 12:23:52 +01:00
Raul Ochoa
79233471c6 Merge pull request #832 from CartoDB/layers-filters
Support individual layer id filters
2017-12-28 19:48:18 +01:00
Raul Ochoa
a75beefe6e Upgrades windshaft to 4.1.1 2017-12-28 18:34:53 +00:00
Raul Ochoa
e43ccf4f12 Going red: individual layer id filters fail
Depends on https://github.com/CartoDB/Windshaft/pull/584.
2017-12-28 18:19:52 +00:00
Raul Ochoa
cd8e320534 Merge pull request #831 from CartoDB/fail-on-uncaught-exceptions
Make tests to fail if they got an uncaught exception
2017-12-28 19:15:29 +01:00
Raul Ochoa
d7f4d39aa2 Don't not override the full client but only the provided methods 2017-12-28 18:09:41 +00:00
Raul Ochoa
89333185a9 Make tests to fail if they got an uncaught exception 2017-12-28 16:37:17 +00:00
Daniel García Aubert
99b95cf839 Move check of default-aggregation to mapconfig model 2017-12-28 13:50:59 +01:00
Daniel García Aubert
9fbc56b82c Remove FIXME notes to test against PostGIS vector renderer 2017-12-28 13:13:32 +01:00
Daniel García Aubert
9a1bc51fdb Use aggregation-mapconfig's method to discover columns to be exposed used to aggregate 2017-12-28 13:12:41 +01:00
Daniel García Aubert
d42257127b Add method to discover required columns or all of them if it's a default aggregation 2017-12-28 13:11:32 +01:00
Daniel García Aubert
5a730c6df1 Remove exited containers after running test against docker 2017-12-28 13:10:11 +01:00
Daniel García Aubert
418c8691d1 Support default full-sample aggregation for postgis vector renderer 2017-12-27 20:08:43 +01:00
Daniel García Aubert
9885045b41 Do not default to null 2017-12-27 12:48:06 +01:00
Daniel García Aubert
062e6f9594 Merge branch 'full-sample' of github.com:CartoDB/Windshaft-cartodb into pg-mvt-do-not-filter-columns 2017-12-27 12:45:43 +01:00
Daniel
d8428938ae Merge pull request #829 from CartoDB/vector-tiles-doc
Update vector tiles documentation
2017-12-26 11:42:06 +01:00
Simon Martín
ca5f280cb3 updating NEWS.md 2017-12-26 11:03:12 +01:00
Simon Martín
524d5a5597 Merge pull request #828 from Algunenano/i827_timestamp
Timeseries: Avoid collisions with columns named 'timestamp'
2017-12-26 09:55:46 +01:00
Daniel García Aubert
a43779b050 Get columns from layer query a set them into layer opptions 2017-12-22 18:19:57 +01:00
Javier Goizueta
ef3917fa6f Update vector tiles documentation
This update reflects the fact that CartoCSS is now optional for vector tiles.
2017-12-22 17:18:42 +01:00
Raul Marin
031e1253ca Numeric histograms: Avoid conflicts with 'bin' named columns 2017-12-22 17:12:57 +01:00
Raul Marin
8012d76b68 Timeseries: Avoid collisions with columns named 'timestamp' 2017-12-22 15:58:40 +01:00
Javier Goizueta
d726c9ad01 Fix point-sample aggregation
it failed in  the case of aggregate columns with the name of base columns
2017-12-22 15:48:30 +01:00
Javier Goizueta
1ce8076699 Change default aggregation placement to point-sample
For consistency with the default aggregation.
2017-12-22 15:46:29 +01:00
Javier Goizueta
54f32113f3 Add some aggregation tests 2017-12-22 15:45:34 +01:00
Javier Goizueta
19bf079f2d Exclude test from PostGIS 2.4 2017-12-22 15:45:14 +01:00
Daniel García Aubert
b7ecde5c9d Add function get columns for layer's query 2017-12-22 13:43:30 +01:00
Daniel García Aubert
a2f804d79f Use full-sample aggregation mode 2017-12-22 12:15:37 +01:00
Daniel García Aubert
efdfabf3e9 Remove method 2017-12-22 12:14:34 +01:00
Javier Goizueta
e9a4fc4b2c Use full-sample aggregation only as default
Sampling is performed only when placement, columns or dimensions are specified;
otherwise the regular centroid/grid-point/grid-center is used without sampling.
2017-12-22 11:31:33 +01:00
Daniel García Aubert
a1d536642e Merge branch 'full-sample' into pg-mvt-do-not-filter-columns 2017-12-21 20:01:07 +01:00
Daniel García Aubert
3c00266666 Add support for aggregated columns in mvt format 2017-12-21 20:00:17 +01:00
Daniel García Aubert
7f64d15944 Merge branch 'master' into full-sample 2017-12-20 15:58:58 +01:00
Daniel
8259271184 Merge pull request #826 from CartoDB/fix-typo-dimensions
Fix typo
2017-12-20 15:02:32 +01:00
Daniel García Aubert
20366cedb4 Skip test for PostGis 2.4 2017-12-20 14:53:34 +01:00
Daniel García Aubert
a102d1d366 jshint, I hate you 2017-12-20 14:41:29 +01:00
Daniel García Aubert
4b97b4fd26 Fix typo 2017-12-20 14:35:47 +01:00
Daniel
b94debf10e Merge pull request #825 from CartoDB/export-supported-placements
Export supported placements and create static methods to expose them
2017-12-20 13:27:23 +01:00
Daniel García Aubert
60030784c1 Export supported placements and create static methods to expose them in a fancy way 2017-12-20 12:42:29 +01:00
Daniel García Aubert
cc9b190e5d Minor style formats 2017-12-19 16:17:37 +01:00
Daniel García Aubert
4946ca688c Add test to check full-sample query 2017-12-19 16:17:13 +01:00
Daniel García Aubert
d2828ecaff Update test 2017-12-19 13:07:57 +01:00
Daniel García Aubert
5a3dd6a914 Use supported placemets of aggregation-query 2017-12-19 13:00:18 +01:00
Daniel García Aubert
bcd2fd8f88 Export supported placements 2017-12-19 12:59:33 +01:00
Daniel García Aubert
94a5e66881 Merge branch 'master' into full-sample 2017-12-19 12:47:36 +01:00
Daniel García Aubert
d55b78f76b Update next release version in NEWS 2017-12-19 12:46:29 +01:00
Daniel García Aubert
42149f9ae7 Update NEWS 2017-12-19 12:45:30 +01:00
Daniel
1e08d946b1 Merge pull request #822 from CartoDB/aggregation-validation
Validate aggregation input params
2017-12-19 12:42:28 +01:00
Daniel García Aubert
f22216e6d2 Catch error threw from constructor and follow node callback pattern 2017-12-19 12:23:54 +01:00
Raul Marin
d9cf830fb4 Stub for next release 2017-12-19 12:23:27 +01:00
Raul Marin
b762008c79 Release 4.5.0 2017-12-19 12:23:27 +01:00
Raul Marin
ca2c2b80d8 Update NEWS 2017-12-19 12:09:14 +01:00
Raul Marin
f946dfa65f Date histograms: Add tests for the new aggregation modes 2017-12-19 12:09:14 +01:00
Raul Marin
418f5faa11 Date histogram: Reduce the threshold to change in auto mode to 100 2017-12-19 12:09:14 +01:00
Raul Marin
bba6db9dbf Date histogram: Add second, decade, century and millenium aggregations 2017-12-19 12:09:14 +01:00
Daniel García Aubert
326cad2f2c Typo 2017-12-19 10:54:20 +01:00
Daniel García Aubert
34808d6147 Improve naming 2017-12-19 10:50:53 +01:00
Daniel García Aubert
79b04bbdfd Rename param 2017-12-19 10:47:53 +01:00
Daniel García Aubert
45a663d5ae Split columns validator 2017-12-19 10:43:34 +01:00
Daniel García Aubert
cace6169c0 Add function to create layer errors 2017-12-19 10:25:41 +01:00
Daniel García Aubert
bdce2f95f2 Add validations for columns 2017-12-18 20:42:26 +01:00
Javier Goizueta
506e16fc87 Experimental full-sample aggregation 2017-12-18 20:18:37 +01:00
Daniel García Aubert
c367743d76 Export SUPPORTED_AGGREGATE_FUNCTIONS 2017-12-18 20:06:16 +01:00
Daniel García Aubert
fa7140e736 Rename argument 2017-12-18 19:52:50 +01:00
Daniel García Aubert
c63226cd26 Improve function naming 2017-12-18 19:51:55 +01:00
Daniel García Aubert
777df6337b Style typo 2017-12-18 19:47:11 +01:00
Daniel García Aubert
2dda0a80da Improve error context 2017-12-18 19:35:12 +01:00
Daniel García Aubert
e2bd97eea6 Move validation to the constructor 2017-12-18 19:19:02 +01:00
Daniel García Aubert
fb03cd3424 Move aggregation validation to its own module 2017-12-18 19:17:43 +01:00
Daniel García Aubert
8a48b96c53 Rename file 2017-12-18 19:06:01 +01:00
Daniel García Aubert
76b0c94835 Rename file 2017-12-18 19:05:49 +01:00
Daniel García Aubert
6a36aa1f13 Order checks to validate if a layer should be adapted 2017-12-18 18:56:53 +01:00
Daniel García Aubert
800870e783 Remove local variable 2017-12-18 18:55:32 +01:00
Daniel García Aubert
6638ba91c3 Refactor supported geometry types 2017-12-18 18:53:44 +01:00
Daniel García Aubert
47e4b9da0d Encapsulate threshold layer validation in aggregation-mapconfig 2017-12-18 18:43:14 +01:00
Daniel García Aubert
81e0c3a098 Add RESOLUTION default getter 2017-12-18 18:26:08 +01:00
Daniel García Aubert
2068861988 Add PLACEMENT default getter 2017-12-18 18:24:09 +01:00
Daniel García Aubert
878f3bd627 Move .sql() to aggregation-mapconfig 2017-12-18 18:17:01 +01:00
Daniel García Aubert
170fcc1973 Move static methods 2017-12-18 17:42:12 +01:00
Daniel García Aubert
d0c88ce21d Improve naming 2017-12-18 17:26:41 +01:00
Javier Goizueta
86d8f28661 Merge pull request #818 from CartoDB/fix-aggr-grid-point
Fix grid-point aggregation placement
2017-12-18 16:37:39 +01:00
Javier Goizueta
e97147ddb4 Fix grid-point aggregation placement 2017-12-18 15:48:51 +01:00
Simon Martín
a40bc4a527 Merge pull request #816 from CartoDB/stringify-for-error-log
Stringify for error log
2017-12-18 15:03:28 +01:00
Simon Martín
77f64bee8c stringifyForLogs more usual case first 2017-12-18 14:54:36 +01:00
Daniel García Aubert
e81a16ce0d Improve validation by applying refactor 2017-12-18 14:31:53 +01:00
Daniel García Aubert
153a792fcb Improve validation by applying refactor 2017-12-18 14:25:44 +01:00
Daniel García Aubert
5c1b1e3214 Improve validation by applying refactor 2017-12-18 14:21:03 +01:00
Daniel García Aubert
0bca3d6f33 Validate placement, threshold and resolution 2017-12-18 13:42:27 +01:00
Simon Martín
14e90a6c76 add line at EOF 2017-12-18 12:59:44 +01:00
Simon Martín
a57cd25bec test escape chars function 2017-12-18 12:35:44 +01:00
Simon Martín
a46f7b3099 nested options and using it 2017-12-18 12:34:56 +01:00
Simon Martín
cb7fb97a13 escape chars function 2017-12-18 11:14:27 +01:00
Daniel García Aubert
e4ae3e235d Merge branch 'master' of github.com:CartoDB/Windshaft-cartodb 2017-12-18 10:17:04 +01:00
Javier Goizueta
423620b6c5 Merge pull request #813 from CartoDB/point-grid-bug
Fix point-grid aggregation bug
2017-12-15 11:27:56 +01:00
Javier Goizueta
877ed63090 Add tests for the different aggregation placement values 2017-12-15 11:14:17 +01:00
Ivan Malagon
8e9f61f9f1 Merge pull request #809 from CartoDB/analyses-filters-params
Add `no_filters` param to dataviews
2017-12-15 11:13:56 +01:00
Javier Goizueta
81e54660bb Fix point-grid aggregation bug 2017-12-15 10:52:41 +01:00
Daniel García Aubert
4d6c501fa5 Merge branch 'master' of github.com:CartoDB/Windshaft-cartodb 2017-12-15 10:31:55 +01:00
Raul Ochoa
55d9c02f8d Merge pull request #812 from CartoDB/fix-agg-point-sample-grid
Use source query as attribute instead of function
2017-12-14 19:58:46 +01:00
Raul Ochoa
a0c24d132e Use source query as attribute instead of function 2017-12-14 18:43:59 +00:00
Daniel García Aubert
6dd4914460 Update NEWS 2017-12-14 18:52:54 +01:00
Daniel
ee4e7b01a9 Merge pull request #806 from CartoDB/mapconfig-aggregation
Mapconfig aggregation
2017-12-14 18:38:00 +01:00
Daniel García Aubert
434de7786c Fix test from merge 2017-12-14 18:26:15 +01:00
Daniel García Aubert
07b4cb78b1 Merge branch 'master' into mapconfig-aggregation 2017-12-14 18:19:54 +01:00
Javier Goizueta
6b472c0b20 Experimental aggregation dimensions
This is not meant por public consumption (exposing SQL expressions is undesiderable)
2017-12-14 17:51:49 +01:00
Ivan Malagon
4b0a4dd675 Update NEWS.md 2017-12-14 17:44:46 +01:00
Ivan Malagon
97f8c361ed Merge branch 'master' into analyses-filters-params 2017-12-14 17:40:14 +01:00
Javier Goizueta
0c044636ef Fix mode aggregation 2017-12-14 17:22:50 +01:00
Javier Goizueta
f95c310462 Redefine aggregation torque to match Torque
Now the resolution aggregation parameter has the same meaning as in Torque (-torque-resolution in CartoCSS)
2017-12-14 17:04:23 +01:00
Javier Goizueta
9d8ce6bc44 Refactor aggregation resolution 2017-12-14 17:04:23 +01:00
Daniel García Aubert
e4407ece84 Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation 2017-12-14 16:39:07 +01:00
Javier Goizueta
507d105ab2 Add mode aggregation 2017-12-14 16:37:40 +01:00
Javier Goizueta
ba6cca46a1 Fix aggregation queries 2017-12-14 16:37:15 +01:00
Javier Goizueta
753ada0e76 Add cartodb_id to test datasets 2017-12-14 16:36:24 +01:00
Daniel García Aubert
d311dccce8 Add test to check tangram compatibility 2017-12-14 16:35:09 +01:00
Javier Goizueta
b81cfe418a Always add a _cdb_feature_count to aggregated queries 2017-12-14 15:02:03 +01:00
Daniel García Aubert
8ee4a2c049 Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation 2017-12-14 14:15:20 +01:00
Daniel García Aubert
a987f6ac05 Fix issue when the sql has single quotes defined and the aggregation metadata query was not able to estimate row count 2017-12-14 14:14:55 +01:00
Javier Goizueta
b0e47ecc62 Fix aggregation resolution parameter
It was implemented as the inverse of the intended value
2017-12-14 12:23:02 +01:00
Javier Goizueta
daa3fdca11 Fix bug in point-grid aggregation 2017-12-14 12:14:31 +01:00
Daniel García Aubert
bcfc43a517 jshint, my old friend 2017-12-14 11:22:00 +01:00
Daniel García Aubert
b83351a504 Use last release of windshaft 2017-12-13 20:07:23 +01:00
Daniel García Aubert
1edf684475 Fix test 2017-12-13 20:04:06 +01:00
Daniel García Aubert
0bc68d7144 Do not override sql_raw 2017-12-13 19:46:25 +01:00
Daniel García Aubert
52d1cd47db Do not validate aggregation missing columns. It will fail afterwards in map validation 2017-12-13 19:24:17 +01:00
Daniel García Aubert
98e8d745b1 Support sql_wrap for aggregation 2017-12-13 17:01:43 +01:00
Daniel García Aubert
e8740af6ef Fix issue when sql_wrap is provided and aggregation metadata query fails 2017-12-13 16:34:36 +01:00
Simon Martín
a00f468e62 NEWS.md 2017-12-13 15:07:55 +01:00
Simon Martín
27a52b66c6 Merge pull request #800 from CartoDB/errorLogs
Logging all errors
2017-12-13 15:05:11 +01:00
Simon Martín
96b9d498fd Merge branch 'master' into errorLogs 2017-12-13 14:50:51 +01:00
Javier Goizueta
6d30903531 Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation
# Conflicts:
#	lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js
2017-12-13 12:53:20 +01:00
Javier Goizueta
4a63fed943 Simplify Aggregation classes
We're using the same aggregation queries for the Raster and Vector cases, so we don't need the class hierarchies used to handled them differently.
AggregationProxy has been renamed to Aggregation
2017-12-13 12:35:17 +01:00
Daniel García Aubert
6fe73862f3 Create a MapConfig's subclass to delegate aggregation 2017-12-13 11:42:51 +01:00
Ivan Malagon
1664975dd1 Add spec 2017-12-13 10:43:43 +01:00
Ivan Malagon
02ac25181e Return error if no_filters and own_filter are present 2017-12-13 09:45:35 +01:00
Daniel García Aubert
239aa12622 Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation 2017-12-12 20:28:50 +01:00
Daniel García Aubert
aa43eb8953 Remove aggregation validation and use MapConfig validation 2017-12-12 20:10:42 +01:00
Daniel García Aubert
6d46a21005 Validate aggregation query param 2017-12-12 19:23:21 +01:00
Raul Ochoa
fb7f79594d Merge remote-tracking branch 'origin/master' into mapconfig-aggregation 2017-12-12 17:15:22 +00:00
Daniel García Aubert
f390a10830 Remove methods that check map-config aggregation and use the ones that MapConfig model provides 2017-12-12 17:58:42 +01:00
Javier Goizueta
4193f96c03 Fix point-grid aggregation query 2017-12-12 17:38:39 +01:00
Raul Ochoa
afa1e2881f Stubs next version 2017-12-12 16:24:12 +00:00
Raul Ochoa
3fa6750f9a Release 4.4.0 2017-12-12 16:23:37 +00:00
Raul Ochoa
1c842c1592 Merge pull request #810 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.60.0
2017-12-12 17:22:06 +01:00
Raul Ochoa
3c88634d09 Upgrades camshaft to 0.60.0 2017-12-12 16:14:49 +00:00
Simon Martín
19bb11adc5 line at EOF 2017-12-12 16:59:07 +01:00
Javier Goizueta
4405d61845 Remove support for arbitrary aggregation SQL expressions.
Only the supported aggregate functions can be used now, currently count, sum, avg, min & max.
2017-12-12 16:17:42 +01:00
Simon Martín
1bb716ef33 Merge branch 'master' into errorLogs 2017-12-12 16:15:30 +01:00
Javier Goizueta
eb2825eea8 Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation
# Conflicts:
#	lib/cartodb/models/aggregation/aggregation-templates.js
2017-12-12 16:08:58 +01:00
Ivan Malagon
811f2bdae3 Fix linter problem 2017-12-12 16:04:25 +01:00
Ivan Malagon
53bc14bc9e Add missing contributors 2017-12-12 16:02:39 +01:00
Ivan Malagon
50ddfaa968 Fix broken spec 2017-12-12 15:56:16 +01:00
Daniel García Aubert
ae35acd21d typo 2017-12-12 15:54:36 +01:00
Daniel García Aubert
d4d32bdfa3 Make jshint more happy 2017-12-12 15:53:35 +01:00
Javier Goizueta
3b7db0b08f Fix typo 2017-12-12 15:48:25 +01:00
Ivan Malagon
43fec74372 Modify params specs 2017-12-12 15:12:33 +01:00
Mario de Frutos
c7f5f310f0 Stubs next version 2017-12-12 13:46:54 +01:00
Daniel García Aubert
e26cfb2efb Remove magic number 2017-12-12 13:32:01 +01:00
Mario de Frutos
b32d056efe Updated NEWS.md 2017-12-12 13:22:57 +01:00
Mario de Frutos
65308ea2eb Updated NEWS.md 2017-12-12 13:21:27 +01:00
Mario de Frutos
8d16bf566d Force png tile generation for static maps (#808)
* Force png tile generation for static maps

If the user tries to generate a static map requesting JPG it will fail
because is going to try to generate the tiles using JPG as format which
is not supported by now, this bug was introduced in the version 4.0.1

So we now force, again, the tiles to be generated as PNG but we pass
the requested format, JPG, to windshaft to generate the final image as
the user reqests

* Added support to define image format in the image assertions

* Added test for JPEG static image generation

Also I've added support for:

- JPEG images
- Different tolerance based on the file type, it seems that due to
  different compression we need different tolerance for JPG images
2017-12-12 13:20:22 +01:00
Daniel García Aubert
0b27d174ef Check if query retrieves results 2017-12-12 12:53:29 +01:00
Daniel García Aubert
869f2ac322 Improve error message 2017-12-12 12:39:12 +01:00
Daniel García Aubert
5bc1903677 Add test to check if cartoccs and aggregation definition are fully compatible 2017-12-12 12:15:13 +01:00
Daniel García Aubert
faaebaa07d Remove console.log 2017-12-12 12:02:10 +01:00
Daniel García Aubert
eceffda87f Do not use control flag 2017-12-12 12:01:25 +01:00
Daniel García Aubert
e93fe13b41 Get the right columns from aggregation 2017-12-12 11:57:38 +01:00
Ivan Malagon
245d24ea29 Merge branch 'master' into analyses-filters-params 2017-12-12 11:54:32 +01:00
Ivan Malagon
605be77a04 Add nofilters query param 2017-12-12 11:54:09 +01:00
Daniel García Aubert
acd0610517 Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation 2017-12-12 11:31:56 +01:00
Javier Goizueta
e37682403c Fix test
Note that the CartoCSS should reference columns of the aggregated table
2017-12-12 11:22:10 +01:00
Javier Goizueta
b2fcbdd8a3 Implement aggregation columns 2017-12-12 11:22:09 +01:00
Daniel García Aubert
2f68d658f0 Remove local variable 2017-12-12 11:10:12 +01:00
Daniel García Aubert
85e7245a33 Remove control flag 2017-12-12 11:07:04 +01:00
Simon Martín
2db2546cca changing error log format 2017-12-12 11:04:06 +01:00
Simon Martín
b3d7909849 removing default error log value 2017-12-12 11:03:52 +01:00
Simon Martín
b035b5d384 Merge branch 'master' into errorLogs 2017-12-12 10:59:07 +01:00
Daniel García Aubert
f52cc276be Remove control flag 2017-12-12 10:57:50 +01:00
Daniel García Aubert
c637caf9c9 Replace nested conditional with guard clause 2017-12-12 10:56:23 +01:00
Daniel García Aubert
d405987a96 Replace nested conditional with guard clause 2017-12-12 10:49:05 +01:00
Daniel García Aubert
06efe410ef Replace nested conditional with guard clause (early return) 2017-12-12 10:43:49 +01:00
Daniel García Aubert
5bf4eba215 Remove unused thenable 2017-12-11 19:35:59 +01:00
Daniel García Aubert
87c4848e19 Improve namig 2017-12-11 19:22:15 +01:00
Daniel García Aubert
3f075ca432 Remove unused argument 2017-12-11 19:18:29 +01:00
Daniel García Aubert
6725025e1a Improve naming for a method 2017-12-11 19:17:32 +01:00
Daniel García Aubert
8d42909eab Change argument order to be more consistent 2017-12-11 19:14:16 +01:00
Daniel García Aubert
d947700646 Get connection at the begining of adapt layers functionality 2017-12-11 19:12:10 +01:00
Daniel García Aubert
cc68b84212 Extract checkLayerAggregationMetadata method 2017-12-11 19:06:53 +01:00
Daniel García Aubert
446449bbde Move variable declaration close to the place that it's used 2017-12-11 18:47:20 +01:00
Daniel García Aubert
b1f788fb57 Remove unuseful callback 2017-12-11 18:42:03 +01:00
Daniel García Aubert
f80e7112bc Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation 2017-12-11 18:35:54 +01:00
Daniel García Aubert
68f967e582 Extract adaptLayer method 2017-12-11 18:34:22 +01:00
Javier Goizueta
2edcbb4724 Implement aggregation queries.
Implmented for placements: centroid, point-gird, point-sample.
Aggregated columns not yet implemented (only count).
Aggregation could be made more efficient by using quadkeys
2017-12-11 18:33:06 +01:00
Daniel García Aubert
006dd86614 Merge branch 'master' into mapconfig-aggregation 2017-12-11 17:36:58 +01:00
Daniel García Aubert
dab204ea71 Do not aggregate if rows cout is lower than threshold or the layer's sql has geometries distinct of points 2017-12-11 17:32:06 +01:00
Raul Marin
f2fa650661 Stub for next release 2017-12-11 17:24:26 +01:00
Simon Martín
1c6c3962db Merge branch 'master' into errorLogs 2017-12-11 12:59:42 +01:00
Raul Marin
aa57cdefb3 Release 4.3.0 2017-12-11 11:27:13 +01:00
Raul Marin
7c5b7641d8 Date histogram: Add missing GROUP BY column 2017-12-11 11:27:13 +01:00
Raul Marin
eb4a49ec92 Update NEWs file with the changes 2017-12-11 11:27:13 +01:00
Raul Marin
88f02458db Timeseries tests: Make jshint happy 2017-12-11 11:27:13 +01:00
Raul Marin
1b405e42c2 Date histogram optimizations 2017-12-11 11:27:13 +01:00
Raul Marin
bb5bfd10ee Timeseries tests: Make them work with any DB setup 2017-12-11 11:27:13 +01:00
Raul Marin
088a8b81a6 Timeseries tests: Set timestamps to the start of the aggregations
Also, increase the end of the range check so it includes some data
2017-12-11 11:27:13 +01:00
Raul Marin
243e982bd6 Optimize formulae queries 2017-12-11 11:27:13 +01:00
Raul Marin
dfe01c836c Escape getQueryRowCount with $$ 2017-12-11 11:27:13 +01:00
Raul Marin
fcbf5ffcc5 Move sql helper functions to query-utils.js 2017-12-11 11:27:13 +01:00
Raul Marin
90c9ad18e0 Optimize histogram queries 2017-12-11 11:27:13 +01:00
Daniel García Aubert
214d684fcc Adapt layer when is vector only map-caonfig 2017-12-05 20:39:30 +01:00
Daniel García Aubert
9118e2dc5e Add tests 2017-12-05 20:21:20 +01:00
Daniel García Aubert
e7592ee570 Improve error message 2017-12-05 17:44:52 +01:00
Daniel García Aubert
81d99ca655 Make test to pass 2017-12-05 16:52:15 +01:00
Daniel García Aubert
7b35701fa8 Extract method 2017-12-05 16:50:18 +01:00
Daniel García Aubert
4f8b541010 Mark aggregation queries 2017-12-05 13:12:25 +01:00
Daniel García Aubert
55dd049812 Be able to skip aggregation to create a layergroup with aggregation defined already 2017-12-05 12:59:32 +01:00
Daniel García Aubert
66b41a6ae7 Now .getLayergroup() in test client accepts params to perform custom instantiations 2017-12-05 12:09:31 +01:00
Daniel García Aubert
499e9de75d Use devel branch of windshaft 2017-12-04 19:49:35 +01:00
Daniel García Aubert
855f47e446 Detect incompatible CartoCSS or interactivity for raster aggregation 2017-12-04 19:48:06 +01:00
Daniel García Aubert
fc472e65b6 Update yarn.lock 2017-12-04 15:31:45 +01:00
Daniel García Aubert
91e0e0fd18 Merge branch 'master' into mapconfig-aggregation 2017-12-04 14:49:44 +01:00
Daniel García Aubert
16a36a9d7a Stubs next version 2017-12-04 13:35:23 +01:00
Daniel García Aubert
893b886a1e Release 4.2.0 2017-12-04 13:34:02 +01:00
Daniel
a60b335151 Merge pull request #803 from CartoDB/vr-aggregation
Allow to request MVT tiles without CartoCSS
2017-12-04 13:32:15 +01:00
Daniel García Aubert
9ee0e2c3d0 Merge branch 'master' into vr-aggregation 2017-12-04 13:26:53 +01:00
Daniel García Aubert
565cfb7fbe Update NEWS 2017-12-04 13:23:09 +01:00
Daniel García Aubert
0c8a31fad9 Remove duplicated code 2017-12-04 13:17:37 +01:00
Daniel García Aubert
169b95809a Upgrade windshaft to version 4.1.0 2017-12-04 13:06:45 +01:00
Daniel García Aubert
077f19d506 Integrate aggregation and get metadata for layergroup 2017-12-04 12:40:53 +01:00
Simon Martín
ed51513b5e adding error header acceptance test 2017-12-01 17:52:20 +01:00
Daniel García Aubert
52630b8084 Minor improvementes 2017-12-01 17:06:42 +01:00
Daniel García Aubert
6f04214f5d Simplify to pass test 2017-12-01 17:06:03 +01:00
Daniel García Aubert
f376a7cdd5 Use aggregation adapter before the overviews one 2017-12-01 17:05:01 +01:00
Daniel García Aubert
b7c6f5acdf Merge branch 'vr-aggregation' into mapconfig-aggregation 2017-12-01 16:23:54 +01:00
Daniel García Aubert
0887e5d5f7 Extract method 2017-12-01 15:43:15 +01:00
Daniel García Aubert
23c0cb757d Fix tests according to the last changes in windshaft 2017-12-01 13:52:28 +01:00
Daniel García Aubert
d01857923e Plug aggregation mapconfig adapter 2017-11-30 19:31:00 +01:00
Daniel García Aubert
deb29f2c77 Implement aggregation mapconfig adapter (happy case) 2017-11-30 19:20:59 +01:00
Daniel García Aubert
d937ed31d5 Add params to instantiate aggregation 2017-11-30 19:10:57 +01:00
Daniel García Aubert
73ae736603 Add aggregation proxy 2017-11-30 19:02:30 +01:00
Daniel García Aubert
1767b83d09 Aggregation query models: bootstrap hierarchy classes 2017-11-30 15:34:20 +01:00
Simon Martín
ba3af551e3 update test file name 2017-11-30 15:04:38 +01:00
Simon Martín
e0d4a9e596 change funcion name 2017-11-30 15:04:07 +01:00
Daniel García Aubert
e18e86f565 jshint, jshint, jshint 2017-11-29 18:28:42 +01:00
Daniel García Aubert
496778c276 Separate suites 2017-11-29 18:17:51 +01:00
Mario de Frutos
0ba4975360 Bump next version 2017-11-29 18:02:46 +01:00
Daniel García Aubert
e3d95fa654 Merge branch 'master' into vr-aggregation 2017-11-29 17:16:57 +01:00
Daniel García Aubert
cded5afdcb Ahh! jshint.. my old friend 2017-11-29 16:56:28 +01:00
Daniel García Aubert
1b6de9961a Do not use polygons 2017-11-29 16:47:56 +01:00
Mario de Frutos
a20e789302 Release 4.1.1 2017-11-29 16:34:48 +01:00
Mario de Frutos
f41af41bd4 Update to turbo-carto 0.20.2 (#805) 2017-11-29 16:32:22 +01:00
Daniel García Aubert
c9e0f330c0 Add test to check incompatible layers 2017-11-29 16:15:52 +01:00
Daniel García Aubert
f9428682f9 Remove mocha filter 2017-11-29 14:38:06 +01:00
Daniel García Aubert
330f8f3cb5 Test invalid format for vector layergroup 2017-11-29 14:10:56 +01:00
Daniel García Aubert
8270699b8e Tests to fect mvt tiles without styles 2017-11-29 13:12:09 +01:00
Simon Martín
555d3f558c changing error log structure 2017-11-28 18:22:55 +01:00
Simon Martín
386d6bfea8 removing unneeded check 2017-11-28 18:19:28 +01:00
Ubuntu
51c19c0b2e Skip test 2017-11-28 16:49:55 +00:00
Simon Martín
479b8be639 ensuring errored JSONP write a error status code in log 2017-11-28 17:27:05 +01:00
Simon Martín
a007fce913 ensuring vars 2017-11-28 16:02:12 +01:00
Simon Martín
100a2986b9 ensuring all properties in errors headers 2017-11-27 18:43:48 +01:00
Simon Martín
752bfe779e forgotten 'only' 2017-11-27 18:15:27 +01:00
Simon Martín
8cf878f723 testing X-Tiler-Errors existence 2017-11-27 18:14:02 +01:00
Simon Martín
605d7057c9 fix copying array of errors and adding error.label to logs 2017-11-27 18:12:44 +01:00
Simon Martín
60e4defa66 default value in errors header 2017-11-27 17:04:50 +01:00
Simon Martín
e7b8d9b223 moving logErrors to right position 2017-11-27 16:55:11 +01:00
Simon Martín
e041b5b8a9 removing ~lost space 2017-11-27 16:52:19 +01:00
Simon Martín
4a2950796b rest of environments config 2017-11-27 16:48:25 +01:00
Simon Martín
9a8f72b8db format details 2017-11-27 16:47:45 +01:00
Simon Martín
667925c455 adding error name, ensuring data and moving errors copy 2017-11-27 16:43:04 +01:00
Daniel García Aubert
de376eef86 vr-aggregation: link to windshaft#vr-aggregation 2017-11-27 14:52:30 +01:00
Simon Martín
f24217a400 cloning object and removing logs 2017-11-24 18:06:17 +01:00
Simon Martín
84fd01535c adding errors to errors header 2017-11-24 17:53:07 +01:00
Simon Martín
e362fca9eb adding new header 2017-11-24 17:52:26 +01:00
Daniel
0a106cd038 Merge pull request #795 from CartoDB/middlewarify-analyses-controller
Middlewarify analyses controller
2017-11-23 12:27:04 +01:00
Daniel García Aubert
1a78b8a75a Merge branch 'master' into middlewarify-analyses-controller 2017-11-23 11:47:57 +01:00
Daniel García Aubert
e131df601c Use ES6 template string for route definition 2017-11-19 14:05:20 +01:00
Daniel García Aubert
967d9b76e6 Fix EOF 2017-11-19 13:47:07 +01:00
Daniel García Aubert
bee04e2553 Usr ES6 string templates 2017-11-19 12:51:35 +01:00
Daniel García Aubert
37111f396d Unify get catalog and tables middlewares 2017-11-19 12:37:09 +01:00
Daniel García Aubert
4df46fe5ea Move creation of PG client to a middleware 2017-11-17 19:20:42 +01:00
Daniel García Aubert
b1b2054f0a Split metadata function into two middlewares 2017-11-17 19:14:31 +01:00
Daniel García Aubert
c1f2b96bfc Remove step from catalog middleware 2017-11-17 18:32:46 +01:00
Daniel García Aubert
804c6645fa Make catalog method a regular middleware factory 2017-11-17 18:28:37 +01:00
Daniel García Aubert
5d6ccc07fd Move functionality that prepares catalog to be used as response 2017-11-17 18:25:13 +01:00
Daniel García Aubert
a585ba5480 Use early retutn node pattern 2017-11-17 18:07:19 +01:00
Simon Martín
448dcc7d82 Merge pull request #779 from CartoDB/res-locals-user
Don't overwrite data in copy from req.params to res.locals
2017-11-16 11:48:16 +01:00
Simon Martín
0aaafa2068 Merge branch 'master' into res-locals-user 2017-11-16 11:03:43 +01:00
Simon Martín
1aa981d556 Merge pull request #787 from CartoDB/timeoutVectorImage
Timeout vector image
2017-11-16 11:01:16 +01:00
Simon Martín
ccce598b04 Merge branch 'master' into res-locals-user 2017-11-15 18:37:49 +01:00
Simon Martín
667b2a9cb1 removing underscore dependency in locals middleware 2017-11-15 16:56:21 +01:00
Simon Martín
298882f410 remove with spaces and adding line as EOF 2017-11-15 15:07:30 +01:00
Raul Marin
6aaa5f99e2 Test: PARALLEL compatibility (OSX) 2017-11-14 16:18:22 +01:00
Simon Martín
22e3016cd3 Merge branch 'master' into timeoutVectorImage 2017-11-14 15:54:16 +01:00
Daniel García Aubert
d5c552a03a Move functionality that sets cache control header to a middleware 2017-11-14 13:53:42 +01:00
Daniel García Aubert
a5347c27e3 Move sendResponse method to a middleware 2017-11-14 13:49:12 +01:00
Daniel García Aubert
520e84e46b Add acceptance test for analyses controller 2017-11-14 13:46:47 +01:00
Daniel García Aubert
27521964c7 Remove schema from analyses catalog query perfoming that query in the same way that we do for pooling the node status in analyses backend 2017-11-14 12:01:21 +01:00
Daniel García Aubert
bdf4827300 Fix bad call to next middleware callback 2017-11-14 11:28:06 +01:00
Raul Marin
172b3ece71 Test: Strip PARALLEL labels for PostgreSQL releases before 9.6 2017-11-13 14:59:13 +01:00
Daniel
71146dbfaf Merge pull request #790 from CartoDB/fix-issue-maps-controller-refactor
Fix issue maps controller refactor
2017-11-13 13:04:41 +01:00
Daniel García Aubert
38ca5db51b Inline method to set cache-cannel, rollback extract setCacheChannel method for named maps controller 2017-11-13 12:35:46 +01:00
Daniel García Aubert
590233e3ee Inline method to set cache-cannel, rollback extract setCacheChannel method 2017-11-13 12:15:12 +01:00
Daniel García Aubert
6f59c61c8b Add more steps while profiling 2017-11-08 14:27:35 +01:00
Daniel García Aubert
aff5fcda63 Add namespace for getMapConfig step while profiling 2017-11-08 14:08:27 +01:00
Daniel García Aubert
56d33b7f5b Add profiling 2017-11-08 10:52:25 +01:00
Daniel
749b205944 Merge pull request #788 from CartoDB/786-number-categories-param
Add a "category" query param to define the number of categories to be ranked for aggregation dataviews
2017-11-07 17:11:25 +01:00
Daniel
ad0c035e2d Merge pull request #784 from CartoDB/middlewarify-maps-controller
[Middlewarify] Middlewarify map controller
2017-11-07 17:09:02 +01:00
Daniel García Aubert
d15ccd271e Merge branch 'master' into middlewarify-maps-controller 2017-11-07 16:36:52 +01:00
Daniel García Aubert
2aee357006 Improve test structure 2017-11-07 16:28:37 +01:00
Daniel García Aubert
fc9dce0cca Fix typo 2017-11-07 16:22:36 +01:00
Daniel García Aubert
9149f72f42 Update NEWS 2017-11-07 16:21:55 +01:00
Daniel García Aubert
743bb0723b Add query param to define the number of categories to be ranked 2017-11-07 16:14:47 +01:00
Simon Martín
0bf36fa058 remove unneeded encoding control 2017-11-07 16:02:37 +01:00
Simon Martín
970310bf7f add vectorError middleware to named map endpoint 2017-11-07 16:01:08 +01:00
Simon Martín
4fc90db495 timeout error vector with lines 2017-11-07 15:57:33 +01:00
Daniel García Aubert
50ecdb5fee Add test to ensure that categories param is used to compose the aggregation dataview 2017-11-07 12:51:48 +01:00
Simon Martín
1ea4fc50c9 make jshint happy 2017-11-07 11:17:32 +01:00
Simon Martín
cda9a09b8e vector timeout error tests 2017-11-07 11:08:01 +01:00
Simon Martín
216c877f4b verctor error middleware 2017-11-07 11:07:38 +01:00
Simon Martín
33fbff5011 some improvements mvt timeout error script 2017-11-07 11:06:53 +01:00
Daniel García Aubert
c48e89826d Split middleware to follow SRP 2017-11-07 09:50:52 +01:00
Daniel
52542e4a88 Merge pull request #783 from CartoDB/refactor-send-method
[Middlewarify] Don't use a base method to send responses
2017-11-07 09:37:57 +01:00
Daniel García Aubert
693a2e7bee Order middlewares 2017-11-05 19:13:56 +01:00
Daniel García Aubert
f9ba3c41d3 Create new middlewares to init profiling and another to check JSON content-type 2017-11-05 18:55:23 +01:00
Simon Martín
ac153232d0 mvt timeout error creation script 2017-11-03 17:21:01 +01:00
Daniel García Aubert
46289f27df Remove TODO 2017-11-03 15:26:25 +01:00
Daniel García Aubert
05ccf20634 Rename function 2017-11-03 15:12:18 +01:00
Daniel García Aubert
6acb873d95 Enforce all middlewares to follow the same constructor pattern 2017-11-03 15:06:15 +01:00
Daniel García Aubert
65e8609fec Do not bind context if not needed 2017-11-03 09:47:46 +01:00
Daniel García Aubert
677f6caab8 remove funtion 2017-11-03 09:38:36 +01:00
Daniel García Aubert
cb167313d2 Unify middleware builder functions 2017-11-03 09:37:01 +01:00
Daniel García Aubert
2854d0252c Fix typo 2017-11-03 08:48:13 +01:00
Daniel García Aubert
717332d941 Compose instantiate layergroup middleware 2017-11-02 19:24:33 +01:00
Daniel García Aubert
4607e4a12d Compose create layergroup middleware 2017-11-02 19:03:20 +01:00
Daniel García Aubert
3e7106002d Rename response middleware 2017-11-02 18:39:46 +01:00
Daniel García Aubert
08b91f935d Rename error middleware 2017-11-02 18:38:34 +01:00
Daniel García Aubert
1d08734721 Rename middleware 2017-11-02 18:28:37 +01:00
Daniel García Aubert
b11b872b75 Remove step requirement 2017-11-02 11:29:43 +01:00
Daniel García Aubert
93bd2c9e50 Build afterLayergroupCreate middleware as an array of middlewares instead of preforming all them as one middleware 2017-11-02 10:43:22 +01:00
Daniel García Aubert
658763da8c Build after layergroup create while registering routes 2017-11-02 10:33:39 +01:00
Daniel García Aubert
d2b5eaa8c3 Do not proxy create and intantiate middlewares 2017-11-02 10:28:33 +01:00
Daniel García Aubert
eb5bf52bd9 Move profiler start to the right place 2017-11-02 10:22:30 +01:00
Daniel García Aubert
c8000e5cf8 Make a middleware to respond layergroup 2017-11-01 20:06:32 +01:00
Daniel García Aubert
46c76d6a4c Create middleware for layergroup creation (anonymous map) 2017-11-01 19:57:20 +01:00
Daniel García Aubert
e6bec5ccb0 Make style linter happy 2017-11-01 19:28:32 +01:00
Daniel García Aubert
125587522f Create middleware for layergroup creation 2017-11-01 19:27:01 +01:00
Daniel García Aubert
aeb9585708 extract prepare mapconfig and get template to their respective middlewares 2017-11-01 19:02:07 +01:00
Daniel García Aubert
8ed5df0072 Move prepeareConfigFn to a middleware 2017-11-01 17:57:35 +01:00
Daniel García Aubert
6bbaeaa286 Create a custom error middleware to augment error info 2017-10-31 20:49:26 +01:00
Daniel García Aubert
3d15551cb5 Minor style umprovements 2017-10-31 20:10:37 +01:00
Daniel García Aubert
e0ffeb0adc extract surrogate key functionality to its own middleware 2017-10-31 19:50:36 +01:00
Daniel García Aubert
e06f8fe25e Set layergroup-id header in the right middleware 2017-10-31 18:54:32 +01:00
Daniel García Aubert
da2228088e Extract context metadata (turbo-carto) functionallity to its own middleware 2017-10-31 18:42:11 +01:00
Daniel García Aubert
cdc39c8cae Extract addAnalysesMetadata functionallity to its own middleware 2017-10-31 18:25:17 +01:00
Daniel García Aubert
99fa66c026 Extract hash template for layergroup id and dataviews/widgets to a middlewares 2017-10-31 18:06:14 +01:00
Daniel García Aubert
d85a5d83b7 Make afterLayergroupCreate function as a 'middleware' builder 2017-10-31 17:59:32 +01:00
Daniel García Aubert
bb02494e02 Do not perform "increment map view count" in parallel 2017-10-31 17:09:42 +01:00
Daniel García Aubert
39eb0f7bec Avoid regression and update comment 2017-10-31 16:58:00 +01:00
Daniel García Aubert
5f7d5f6ec8 Get analyses results from res.locals 2017-10-31 16:01:18 +01:00
Daniel García Aubert
a4b2044e10 missing early return 2017-10-31 15:58:41 +01:00
Daniel García Aubert
d1093686a3 Avoid to hold info in local variables 2017-10-31 15:51:42 +01:00
Daniel García Aubert
12822c4341 Follow node.js convention regarding early returns 2017-10-31 15:49:10 +01:00
Daniel García Aubert
fab87e2168 Get layergroup from locals. It's not provided by previous middleware anymore 2017-10-31 15:47:59 +01:00
Daniel García Aubert
34e219353c do not pass layergroup since it's already available in res.locals 2017-10-31 14:47:29 +01:00
Daniel García Aubert
3cf4a8f70b Extract layergroup data augmentation to its own "middleware" 2017-10-31 13:46:03 +01:00
Daniel García Aubert
48172d4dc1 make afterLayergroupCreate to follow the middleware signature 2017-10-31 13:36:17 +01:00
Daniel García Aubert
467bee4c91 Split afterLayergroupCreate method in multiple "pre-middlewares" 2017-10-31 13:13:20 +01:00
Daniel García Aubert
3f2ef63976 Extract cache channel to its own method 2017-10-31 11:38:54 +01:00
Daniel García Aubert
235f5e4566 Extract cache channel to its own method 2017-10-31 11:38:18 +01:00
Daniel García Aubert
3f49743cd0 Remove BaseController dependency and remove unused code 2017-10-30 19:30:03 +01:00
Daniel García Aubert
fb3afaa6ab Fix jshint max-complexity issue by using extract method 2017-10-30 19:29:19 +01:00
Daniel García Aubert
b6c405bf68 Remove send method in base controller and remove BaseController class 2017-10-30 19:28:40 +01:00
Daniel
da87a95dd9 Merge pull request #781 from CartoDB/upgrade-windshaft-4.0.1
Upgrade windshaft to version 4.0.1
2017-10-27 11:33:42 +02:00
Daniel García Aubert
cd7c604d10 Update NEWS 2017-10-27 11:18:10 +02:00
Daniel García Aubert
b7227e0581 Upgrade windshaft to version 4.0.1 2017-10-27 11:11:58 +02:00
Iñigo Medina
c564f5467a Merge pull request #780 from CartoDB/docs-format-steps
Fixed numbering formatting for steps
2017-10-20 20:05:41 +02:00
csobier
b04cc9c228 Fixed numbering formatting for steps
No code changes, just formatting. (The API repos require different format of numbering then that docs. I couldn't see it until the output was live).
2017-10-20 12:52:40 -04:00
Simon Martín
c0df0d12c6 ensure dont overwrite data in copy from req.params to res.locals 2017-10-20 17:21:55 +02:00
Daniel García Aubert
00f81db57e Fixed default value for own_filter 2017-10-20 16:47:56 +02:00
Daniel García Aubert
0c9d60b573 Add support for no_filters params in dataviews 2017-10-20 16:19:24 +02:00
Iñigo Medina
5645cd16b3 Merge pull request #778 from CartoDB/docs-1236-vector-tiles
mvt content added to anonymous map chapter, under retrieve resources …
2017-10-19 16:22:56 +02:00
csobier
eb6da1398e mvt content added to anonymous map chapter, under retrieve resources heading- WIP 2017-10-18 13:34:33 -04:00
Daniel García Aubert
35c5cd34c2 Stubs next version 2017-10-18 15:19:37 +02:00
Daniel García Aubert
6c51667ffb Merge branch 'master' of github.com:CartoDB/Windshaft-cartodb 2017-10-18 15:18:14 +02:00
Daniel García Aubert
1396ca9fe3 Release 4.0.1 2017-10-18 15:17:17 +02:00
Iñigo Medina
56bb083239 Merge pull request #775 from CartoDB/docs-1236-vector-tiles
added map tile rendering and MVT info to Maps API doc- WIP
2017-10-18 15:15:38 +02:00
Daniel García Aubert
ddcb812218 Update NEWS 2017-10-18 15:14:03 +02:00
Daniel
66c3d58b92 Merge pull request #777 from CartoDB/upgrade-camshaft-0.59.4
Upgrade camshaft to version 0.59.4
2017-10-18 15:08:02 +02:00
Daniel García Aubert
9326217c18 Upgrade camshaft to version 0.59.4 2017-10-18 14:36:04 +02:00
csobier
1207764c18 added map tile rendering and MVT info to Maps API doc- WIP 2017-10-16 15:54:49 -04:00
Daniel
73a633ae7d Merge pull request #767 from CartoDB/stats-middleware
Implement stats middleware removing some duplicated code
2017-10-16 16:08:55 +02:00
Daniel García Aubert
3068ff1ea4 Update NEWS 2017-10-16 15:16:21 +02:00
Daniel García Aubert
9ad6d0cbcc Merge branch 'master' into stats-middleware 2017-10-16 15:06:20 +02:00
Daniel
86389382fa Merge pull request #773 from CartoDB/fix-test-postgis-2.3
Fix tests in master branch while testing in devel environment (NOT CI)
2017-10-16 14:49:27 +02:00
Daniel García Aubert
c2bf7b075c Fix travis to export environment variable (POSTGIS_VERSION) 2017-10-16 13:24:46 +02:00
Daniel García Aubert
294a222669 Configure travis to export environment variable (POSTGIS_VERSION) 2017-10-16 13:20:30 +02:00
Daniel García Aubert
515146bf28 Configure travis to export environment variable (POSTGIS_VERSION) 2017-10-16 13:12:06 +02:00
Daniel García Aubert
a1c08f9bf7 Revert docker-test config 2017-10-16 12:53:23 +02:00
Daniel García Aubert
f8ff41be01 Do not run test if postgis version is lower than or equal to 2.4 2017-10-16 12:15:28 +02:00
Daniel García Aubert
67ab12e8e7 Add environment variable to check whether to run test against postgis 2.4 or not 2017-10-16 11:08:46 +02:00
David M
d959ef5007 Merge pull request #772 from CartoDB/windshaft4
Target Windshaft ~4.0.0, yarn.lock updated
2017-10-11 11:44:40 +02:00
David Manzanares
8cc4fe5b56 Target Windshaft ~4.0.0, yarn.lock updated 2017-10-11 11:34:27 +02:00
David M
22a34d763c Merge pull request #762 from CartoDB/mvt-path-conf
Add configuration flag to enable/disable direct PgSQL MVT
2017-10-11 10:42:09 +02:00
Raul Ochoa
ad227a5240 Merge remote-tracking branch 'origin/master' into analyses-filters 2017-10-10 16:35:11 +00:00
David Manzanares
d30f710534 Merge remote-tracking branch 'origin/master' into mvt-path-conf 2017-10-10 17:53:28 +02:00
Daniel García Aubert
02304dc450 Merge branch 'master' into stats-middleware 2017-10-10 16:56:35 +02:00
Daniel García Aubert
893fac31a7 Update NEWS 2017-10-10 16:44:11 +02:00
Simon Martín
abef8918c0 Merge pull request #751 from CartoDB/middlewarify
Middlewarify
2017-10-10 15:10:14 +02:00
Simon Martín
8380d291d0 Merge branch 'master' into middlewarify 2017-10-10 14:59:50 +02:00
Daniel García Aubert
251e636ad2 Fix bad argument list while calling to staticMap function 2017-10-10 11:58:24 +02:00
Raul Ochoa
286059b8a3 Merge pull request #770 from CartoDB/test-client-consistent-signature-fix
Make all calls to finish to match (err, res) signature
2017-10-09 18:40:15 +02:00
David M
b18bf967fd Workaround lack of template creation clean-up 2017-10-09 18:27:57 +02:00
Daniel García Aubert
a81e98995a Merge branch 'middlewarify' into stats-middleware 2017-10-09 17:54:32 +02:00
Raul Ochoa
a797e13eb3 Make all calls to finish to match (err, res) signature 2017-10-09 15:51:42 +00:00
Daniel
5e073f39bd Merge pull request #765 from CartoDB/res-locals
req.params to res.locals
2017-10-09 17:44:01 +02:00
David M
8a88b29665 update dependencies 2017-10-09 17:16:29 +02:00
David M
d77739dfa4 PostGIS MVT v2 compliance test skipped without skipping mapnik 2017-10-09 16:46:23 +02:00
Simon Martín
484e0fda2f undo changing services params 2017-10-09 16:29:35 +02:00
David M
3827901535 Skip test to ignore MVT v2 compliance 2017-10-09 15:53:50 +02:00
David M
82648df21c Fix jshint 2017-10-09 15:49:51 +02:00
David M
1766cd0ad4 Buffersize test fixed to test PostGIS and mapnik MVT paths 2017-10-09 15:42:24 +02:00
David M
6af83d7630 Use yarn instead of npm in docker 2017-10-09 14:54:03 +02:00
David M
28501f6b9d MVT PostGIS limit test fixed 2017-10-09 14:46:01 +02:00
Simon Martín
e3405ea2fc doing changes after merge with middlewarify 2017-10-09 12:27:58 +02:00
Simon Martín
5c0f597cbb Merge branch 'middlewarify' into res-locals 2017-10-09 10:55:43 +02:00
Daniel García Aubert
7289394f6a Missing EOL 2017-10-07 19:16:15 +02:00
Daniel García Aubert
1ba1c488fa Do not decorate response methods to set header and send stats 2017-10-07 19:02:26 +02:00
David Manzanares
10f9f61e1e Merge branch 'mvt-path-conf' of github.com:CartoDB/Windshaft-cartodb into mvt-path-conf 2017-10-06 18:24:48 +02:00
David Manzanares
0e20958220 Remove dockerfile 2017-10-06 18:24:29 +02:00
David Manzanares
28cb05e45b Use windshaft docker image 2017-10-06 18:24:11 +02:00
Raul Ochoa
c004e105ef Drain client on after hooks 2017-10-06 16:17:26 +00:00
Raul Ochoa
f456237aa7 Drain client on after hook 2017-10-06 15:53:47 +00:00
David Manzanares
7f66189164 Fix travis.yaml 2017-10-06 16:44:28 +02:00
David Manzanares
cac16f8b66 Travis dockerified 2017-10-06 16:30:35 +02:00
David Manzanares
a706fd81ba Restore MVT path configuration after each suite pass 2017-10-06 16:21:34 +02:00
David Manzanares
43885f130b Fix HTTP status code distinction between 200 and 204 2017-10-06 16:19:00 +02:00
David Manzanares
58be2b8fc5 Merge remote-tracking branch 'origin/improve-test-client' into mvt-path-conf 2017-10-06 16:08:13 +02:00
David Manzanares
78671aa499 remove redundant format support 2017-10-06 16:07:47 +02:00
David Manzanares
d29da0bcc3 Test both MVT paths: mapnik and PostGIS 2017-10-06 16:07:24 +02:00
Raul Ochoa
e9d0b3b77d Merge pull request #769 from CartoDB/improve-test-client
Improve test client
2017-10-06 16:03:30 +02:00
David Manzanares
4e6253b717 Return HTTP 204 for empty tiles 2017-10-06 16:02:16 +02:00
David M
44eb323764 Merge pull request #768 from CartoDB/test-support-fixes
Test support fixes
2017-10-06 15:57:25 +02:00
Raul Ochoa
d4015085c7 Include test/support as part of jshint validation 2017-10-06 15:28:01 +02:00
Raul Ochoa
b9c511ee60 Remove unused file 2017-10-06 15:27:48 +02:00
Raul Ochoa
64fe070ab2 Put layergroupId handling close 2017-10-06 15:27:03 +02:00
Raul Ochoa
5d750f3b98 Several jshint fixes 2017-10-06 15:24:58 +02:00
Raul Ochoa
664892bba9 Complexity already fixed 2017-10-06 15:15:43 +02:00
Raul Ochoa
38c50e0bec Fix jshint hint 2017-10-06 15:15:33 +02:00
Raul Ochoa
6c0e6210d6 Split response validation 2017-10-06 15:15:16 +02:00
Raul Ochoa
f350206990 Strict check 2017-10-06 12:54:37 +00:00
Raul Ochoa
c8d2c9ea37 Do NOT throw error when not being in step context 2017-10-06 12:41:50 +00:00
David Manzanares
cab2d6d5d4 package.json docker-bash script added 2017-10-06 11:03:08 +02:00
Daniel García Aubert
242e63716f Merge branch 'middlewarify' into stats-middleware 2017-10-05 18:21:02 +02:00
Daniel García Aubert
c70b8cb5bf Set X-Served-By-DB-Host header in db-conn-setup middleware 2017-10-05 18:05:46 +02:00
Simon Martín
06138a82a8 Merge branch 'middlewarify' into res-locals 2017-10-05 17:53:15 +02:00
Daniel García Aubert
678fbb1c8f Remove bad argument to middleware callback 2017-10-05 17:28:41 +02:00
Simon Martín
2f310a15bd do not overwrite creation of res.locals 2017-10-05 17:23:07 +02:00
Daniel García Aubert
bf637ccd5b Implement stats middleware removing some duplicated code 2017-10-05 17:06:42 +02:00
David Manzanares
f387f2ee6f Testing dockerified 2017-10-05 16:08:31 +02:00
David Manzanares
34d9e5a4eb Fix MVT test 2017-10-05 16:08:05 +02:00
David Manzanares
54b7ee85c2 Geojson tests adapted to MVT 2017-10-05 14:38:43 +02:00
Simon Martín
9083fc2e20 fix forgotten comment 2017-10-05 12:44:03 +02:00
David Manzanares
72a9a3e097 updated deps 2017-10-05 12:26:19 +02:00
David Manzanares
102228c55b Merge remote-tracking branch 'origin/master' into mvt-path-conf 2017-10-05 12:19:24 +02:00
David Manzanares
148e6e6ae5 Merge branch 'master' into mvt-path-conf 2017-10-05 12:18:08 +02:00
David Manzanares
226653207a target windshaft master branch 2017-10-05 12:17:55 +02:00
Daniel García Aubert
b93c09959c Back to use just one router 2017-10-05 12:12:21 +02:00
Simon Martín
5abe25c316 undo style/format changes 2017-10-05 11:35:49 +02:00
Simon Martín
1f03a6b181 using res.locals instead of params in AuthApi 2017-10-05 11:28:41 +02:00
Simon Martín
16e8202782 stubs next version 2017-10-04 17:11:17 +02:00
Simon Martín
4afa7f70d7 release 4.0.0 2017-10-04 17:06:58 +02:00
Simon Martín
5045f81fe3 Merge pull request #764 from CartoDB/express-v4.15.5
upgrade node modules to enhance security
2017-10-04 15:54:41 +02:00
Simon Martín
ec8fcc7302 change param name and comments updated 2017-10-04 12:50:27 +02:00
Raul Ochoa
2afb6b5ac2 Regenerate yarn.lock to pickup grainstore version 2017-10-04 10:32:36 +00:00
Simon Martín
19e2515a8e Merge pull request #749 from CartoDB/dataview-factory-refactor
Dataview factory refactor
2017-10-04 12:18:55 +02:00
Raul Ochoa
5d6156a257 Add missing upgraded dep 2017-10-04 10:16:26 +00:00
Raul Ochoa
9e217d9199 Merge branch 'master' into express-v4.15.5 2017-10-04 10:16:07 +00:00
Raul Ochoa
a224a0bf91 Unify all pending changes in 4.0.0 version 2017-10-04 10:14:09 +00:00
Raul Ochoa
87bcb7ebf2 Update list of upgraded deps 2017-10-04 10:12:54 +00:00
Raul Ochoa
d06ba8b1f8 Merge remote-tracking branch 'origin/master' into express-v4.15.5 2017-10-04 10:11:08 +00:00
Simon Martín
2b37a406bc Merge pull request #763 from CartoDB/remove-list-dataview
Removes `list` dataview type
2017-10-04 12:01:42 +02:00
Simon Martín
0a507d02bc Merge branch 'master' into remove-list-dataview 2017-10-04 11:36:45 +02:00
Raul Ochoa
49fd75f0b6 Merge remote-tracking branch 'origin/master' into express-v4.15.5 2017-10-04 09:32:46 +00:00
Simon Martín
514aa53152 Merge pull request #748 from CartoDB/base-dataview-refactor
Base dataview refactor
2017-10-04 11:17:38 +02:00
Simon Martín
8fe31c45f3 fix 'this' scope with arrow function 2017-10-04 11:10:17 +02:00
Simon Martín
fe4c22d2ea Merge branch 'master' into base-dataview-refactor 2017-10-04 11:08:43 +02:00
Simon Martín
d27cce915c Merge pull request #747 from CartoDB/formula-dataview-refactor
Formula dataview refactor
2017-10-04 10:10:57 +02:00
Simon Martín
1c3f2b93e3 prepareRequest and prepareResponse in prepare-context.test 2017-10-03 17:58:16 +02:00
Simon Martín
21720267cf from req.context to res.locals 2017-10-03 17:47:57 +02:00
Raul Ochoa
da832263a4 Upgrade turbo-carto, camshaft, and cartodb-psql 2017-10-03 11:46:03 +00:00
Raul Ochoa
69bd14793f Upgrade to windshaft 3.3.3
Regenerate yarn.lock file
2017-10-03 11:21:47 +00:00
Raul Ochoa
54dd15c0b0 Merge remote-tracking branch 'origin/master' into express-v4.15.5 2017-10-03 11:15:31 +00:00
Simon Martín
3ce10690d6 send res.locals instead of res when possible 2017-10-03 13:06:12 +02:00
Simon Martín
6bfc5d8891 fix function name and removing comments of localsMiddleware 2017-10-03 13:03:02 +02:00
Simon Martín
430e1513d8 fix incorrect function parameter 2017-10-03 13:00:52 +02:00
Rafa de la Torre
28c8632532 Merge pull request #766 from CartoDB/update-yarn-v0.27.5
Update yarn version to v0.27.5
2017-10-03 12:54:46 +02:00
Rafa de la Torre
89172f280f Change yarn dep version range specification
In theory the caret `^` should work but as rochoa pointed out it does
not. So changing it (also for the sake of clarity).
2017-10-03 12:43:09 +02:00
Rafa de la Torre
0a7506e4b2 Update yarn version to v0.27.5 2017-10-03 12:10:43 +02:00
Raul Ochoa
2b1f12e9d5 Allow to instantiate maps with analyses filters
This decouples filters from dataviews. They are more verbose now.

Misses validation of filters.
2017-10-02 19:16:44 +02:00
Simon Martín
4fd3c99531 Merge pull request #746 from CartoDB/list-dataview-refactor
List dataview refactor
2017-10-02 17:28:54 +02:00
Simon Martín
1e4c63a6dc Merge pull request #745 from CartoDB/aggregation-dataview-refactor
Aggregation dataview refactor
2017-10-02 17:24:12 +02:00
Simon Martín
742420b159 Merge pull request #744 from CartoDB/time-series-refactor
Histogram refactor
2017-10-02 17:18:21 +02:00
Rafa de la Torre
b8783a6447 Stub NEWS/package for next version 2017-10-02 14:49:01 +02:00
Rafa de la Torre
45dece65f2 Update 3.13.0 release date in NEWS.md 2017-10-02 14:45:43 +02:00
Simon Martín
c894414192 going green 2017-10-02 12:28:29 +02:00
Simon Martín
aa62529041 updating preprare-context test to allow the new res.locals usage 2017-10-02 12:09:19 +02:00
Simon Martín
55f593eae6 adding forgotten semicolon 2017-10-02 12:08:10 +02:00
Simon Martín
f9d87bc40f res.locals fixing controllers 2017-10-02 12:07:35 +02:00
Eneko Lakasta
818cdbd99b upgrade express again (4.16.0) 2017-09-29 17:41:57 +02:00
Simon Martín
783eb0eec7 res.locals format and layer in namep maps 2017-09-29 17:03:57 +02:00
Simon Martín
c22a35489d res.locals forgotten things and make jshint happy 2017-09-29 14:38:28 +02:00
Simon Martín
482feabce2 res.locals in named maps controller 2017-09-29 14:37:55 +02:00
Simon Martín
0a753400e0 res.locals in map controller 2017-09-29 12:54:21 +02:00
Simon Martín
a21648ab4a res.locals in layergroup controller 2017-09-29 12:32:46 +02:00
Simon Martín
b4d03c074a not move db params to res.locals.db 2017-09-29 11:07:11 +02:00
Eneko Lakasta
75c8a73423 upgrade debug to version 3.1 2017-09-29 10:42:20 +02:00
Eneko Lakasta
649383a3df upgrade request module to version 2.83.0 2017-09-28 18:28:04 +02:00
Eneko Lakasta
52402c0333 Revert "upgrade request module"
This reverts commit cacb92b0c4.
2017-09-28 18:25:40 +02:00
Eneko Lakasta
cacb92b0c4 upgrade request module 2017-09-28 18:24:50 +02:00
David Manzanares
5463248578 Changed PostGIS MVT flag name 2017-09-28 17:57:59 +02:00
Eneko Lakasta
aaf95b9223 upgrade body-parser (package.json and yarn.lock) 2017-09-28 17:41:49 +02:00
Eneko Lakasta
6149df1810 upgrade body-parser to version 1.17.2
version 1.17.2 requires a patched query string (qs) module
2017-09-28 17:37:43 +02:00
Eneko Lakasta
ff47027a51 upgrade express version to 4.15.5 2017-09-28 17:20:07 +02:00
David Manzanares
e5cae8b8e3 Added flag documentation 2017-09-28 13:24:50 +02:00
Raul Ochoa
78b75c7a88 Removes list dataview type 2017-09-28 10:47:44 +00:00
Javier Goizueta
56d7c2c140 Merge pull request #760 from CartoDB/upgrade-camshaft-to-0.59.1
Upgrade camshsft to 0.59.1
2017-09-28 12:09:46 +02:00
David Manzanares
ad1abb28af Add configuration flag to enable/disable direct PgSQL MVT 2017-09-28 12:08:22 +02:00
Simon Martín
f824fc5243 base and analyses controller 2017-09-28 12:02:34 +02:00
Simon Martín
4a2cc6a5f8 res.locals in auth_api 2017-09-28 11:55:36 +02:00
Simon
ca612dd02a res.locals in context middlewares 2017-09-28 11:43:12 +02:00
Unknown
fedcb0d0f9 remove unused middleware 2017-09-28 11:23:53 +02:00
Javier Goizueta
c9f0902703 Upgrade camshsft to 0.59.1
This fixes duplicate column names in aggregate-intersection analysis
2017-09-27 18:44:06 +02:00
Simon Martín
1739cee11d Merge pull request #752 from CartoDB/layergroup-token-param
Layergroup token param
2017-09-27 16:44:58 +02:00
Simon
178b9e8563 moving layergroup-token middleware to middlewarify style 2017-09-27 16:32:49 +02:00
Simon
ac474cb253 Merge branch 'middlewarify' into layergroup-token-param 2017-09-27 16:31:08 +02:00
Simon Martín
79510185da Merge pull request #753 from CartoDB/layergroup-token-middleware
Layergroup Token parsing as middleware
2017-09-27 11:44:15 +02:00
Raul Ochoa
c960535709 Merge pull request #756 from CartoDB/upgrade-deps
Upgrades camshaft, cartodb-query-tables, and turbo-carto
2017-09-26 18:32:31 +02:00
Simon
84cd93b1b0 make jshint happy 2017-09-26 18:25:47 +02:00
Simon
134cc9ac0c changing req.locals to res.locals 2017-09-26 18:23:49 +02:00
Daniel García Aubert
615229fc31 Remove comment 2017-09-26 17:32:50 +02:00
Daniel García Aubert
4600005a86 Bring ported test back 2017-09-26 17:31:57 +02:00
Simon
383c8305cc Merge branch 'middlewarify' of github.com:CartoDB/Windshaft-cartodb into middlewarify 2017-09-26 15:40:00 +02:00
Simon
b94dfe066d removing some repeated things 2017-09-26 15:39:48 +02:00
Daniel García Aubert
de267917f4 Merge branch 'middlewarify' of github.com:CartoDB/Windshaft-cartodb into middlewarify 2017-09-26 15:17:20 +02:00
Simon
3f6afb4530 validation middleware for layer route (conflicting route) 2017-09-26 14:56:20 +02:00
Simon
540fda1e6c Merge branch 'master' into middlewarify 2017-09-26 14:53:57 +02:00
Daniel García Aubert
e0e67df91c Merge branch 'master' into middlewarify 2017-09-25 20:04:33 +02:00
Daniel García Aubert
4899c7ffef Inject prepare context middleware to controllers 2017-09-25 19:40:27 +02:00
Raul Ochoa
ac42223439 Allow 6.9.0 version 2017-09-25 15:34:16 +00:00
Raul Ochoa
1110abaa9a Merge pull request #644 from CartoDB/check-node-version
Check node version
2017-09-25 17:33:26 +02:00
Raul Ochoa
3023111896 Reuse existing log methods 2017-09-25 14:55:17 +00:00
Raul Ochoa
66380197f4 Do not explode by - token 2017-09-25 14:53:17 +00:00
Raul Ochoa
8daa4bb08a Merge remote-tracking branch 'origin/master' into check-node-version 2017-09-25 14:51:50 +00:00
Raul Ochoa
b943b09532 Merge pull request #736 from CartoDB/static-named-maps-override-bbox
Static named maps override bbox
2017-09-25 14:10:27 +02:00
Raul Ochoa
eda18726fd Merge pull request #755 from CartoDB/analyses-use-cases-tests
Analyses use cases tests
2017-09-25 14:06:44 +02:00
Daniel García Aubert
f0920aedef Remove unused module 2017-09-25 13:43:15 +02:00
Daniel García Aubert
b236112069 Split prepare context middleware and fix unit test 2017-09-25 13:40:22 +02:00
Raul Ochoa
d3dafc8a40 Regenerate lock file 2017-09-25 11:24:33 +00:00
Raul Ochoa
c734f43643 Upgrades camshaft, cartodb-query-tables, and turbo-carto
Better support for query variables.
2017-09-25 11:11:05 +00:00
Daniel García Aubert
0e8fb68794 Extract token param to a middleware 2017-09-22 18:49:21 +02:00
Daniel García Aubert
f7b9287c93 Return an array of middlewares instead of big one in prepare context 2017-09-22 18:24:16 +02:00
Daniel García Aubert
85d4c81e58 Remove legacy hack 2017-09-22 18:15:48 +02:00
Daniel García Aubert
ff19a8a2fe Rename test 2017-09-22 17:59:51 +02:00
Daniel García Aubert
3bab081438 Rename req2params by prepareContext 2017-09-22 17:56:47 +02:00
Daniel García Aubert
6dc9cc0b23 Remove req2params dependency 2017-09-22 17:56:08 +02:00
Raul Ochoa
3134f40eac Remove advanced use cases that no longer make sense 2017-09-22 15:42:52 +00:00
Raul Ochoa
5cc31cabe2 Fix and enable some old tests related to analyses use cases 2017-09-22 15:41:58 +00:00
Daniel García Aubert
8fd35849c7 Merge branch 'middlewarify' of github.com:CartoDB/Windshaft-cartodb into middlewarify 2017-09-22 17:15:41 +02:00
Simon
c09899913f finishing integration of lzma middleware 2017-09-22 16:46:39 +02:00
Daniel García Aubert
0bdeee64a7 Use express router to group controllers' enpoints and reuse common middleware for named maps admin controller 2017-09-22 16:45:34 +02:00
Daniel García Aubert
ee8619c470 Use express router to group controllers' enpoints and reuse common middleware for analysis controller 2017-09-22 16:28:52 +02:00
Simon
9d81321d78 Merge branch 'master' into middlewarify 2017-09-22 16:26:56 +02:00
Simon Martín
ca63c2ef1a Merge pull request #721 from CartoDB/lzma-middleware
Implement LZMA query param inflating as middleware
2017-09-22 16:16:36 +02:00
Daniel García Aubert
b0486f9bae Use express router to group enpoints and reuse common middlewares for layergroup controller 2017-09-22 15:44:12 +02:00
Raul Ochoa
2eb1c0f3e0 Remove unused import 2017-09-22 12:59:14 +00:00
Raul Ochoa
22b7828725 Layergroup Token parsing as middleware
Reuses LayergroupToken model from tests.
2017-09-22 12:05:40 +00:00
Raul Ochoa
78404b1308 Merge remote-tracking branch 'origin/master' into layergroup-token-param 2017-09-22 11:12:42 +00:00
Raul Ochoa
45698207d9 Merge remote-tracking branch 'origin/master' into static-named-maps-override-bbox 2017-09-22 11:08:12 +00:00
Daniel García Aubert
9bd862ffaf Remove req2params from BaseController and update related test to use the middleware 2017-09-22 01:08:46 +02:00
Daniel García Aubert
8139cdf8b2 Use req2params middleware for name maps static views endpoint 2017-09-22 00:58:44 +02:00
Daniel García Aubert
a8898a8022 Use req2params middleware for name maps tile endpoint 2017-09-22 00:48:44 +02:00
Daniel García Aubert
df5ec0f4d9 Use req2params middleware for analysis catalog endpoint 2017-09-22 00:42:17 +02:00
Daniel García Aubert
51ba3db4ac Use req2params middleware for instantiate named map endpoint 2017-09-22 00:31:16 +02:00
Daniel García Aubert
d31e52a625 Fix format, break line in bad position 2017-09-21 22:55:30 +02:00
Daniel García Aubert
3a8b99a14e Use req2params middleware for tile and layer endpoint 2017-09-21 22:53:31 +02:00
Daniel García Aubert
fac1ab4a1c Use req2params middleware for attributes endpoint 2017-09-21 22:47:08 +02:00
Daniel García Aubert
a9b0acc317 Use req2params middleware for static map (bbox & center) endpoint 2017-09-21 22:43:59 +02:00
Daniel García Aubert
5cb2e5d3c5 Skip temporaly ported test 2017-09-21 21:53:05 +02:00
Daniel García Aubert
e2ed0058d8 Use req2params middleware for layergroup create endpoint 2017-09-21 21:52:34 +02:00
Daniel García Aubert
2f499a148a Use req2params middleware for dataview endpoint 2017-09-21 14:33:32 +02:00
Daniel García Aubert
49204650c6 Use req2params middleware for datavie search endpoint 2017-09-21 14:30:19 +02:00
Daniel García Aubert
234576ab5f Use req2params middleware for analisys node status endpoint 2017-09-21 13:37:32 +02:00
Daniel García Aubert
02cd6a43ad Move req2params method to a its own middleware 2017-09-21 13:27:22 +02:00
Daniel García Aubert
429f070372 Pass node's response object to req2params 2017-09-21 12:22:33 +02:00
Daniel García Aubert
3b9c561cee Change signature of req2params to follow express' middleware pattern 2017-09-21 11:54:37 +02:00
Daniel García Aubert
daeae5d95c Implement error-middleware to handle errors at top level 2017-09-21 11:46:42 +02:00
Raul Ochoa
33121871b0 Stubs next version 2017-09-18 12:47:37 +00:00
Raul Ochoa
f133d983e8 Release 3.12.10 2017-09-18 12:46:40 +00:00
Raul Ochoa
b6237c7bfa Merge pull request #750 from CartoDB/upgrade-windshaft
Upgrades windshaft to 3.3.2
2017-09-18 13:17:12 +02:00
Raul Ochoa
a5d9bfa0ec Upgrades windshaft to 3.3.2 2017-09-18 10:34:04 +00:00
Simon
222cfb90fd Removing 'self' vars using arrow functions 2017-09-18 12:20:59 +02:00
Simon
f63fab40ed Removing 'self' vars using arrow functions 2017-09-18 11:34:18 +02:00
Daniel García Aubert
61ea05d1c2 Do not assign a value by default for special float values counters 2017-09-15 14:51:02 +02:00
Daniel García Aubert
64c3e68303 Fix double declaration of 'result' 2017-09-15 14:48:54 +02:00
Daniel García Aubert
d4bb4edd1d Applyy extract method to check input options 2017-09-15 14:43:41 +02:00
Daniel García Aubert
419b29e609 Do not prefix with '_' template context 2017-09-15 14:43:26 +02:00
Daniel García Aubert
c7ed3d34e8 Use const instead of var to declare variables 2017-09-15 14:43:13 +02:00
Daniel García Aubert
1959a841fd Use arrow function to take advantage of bound context 2017-09-15 14:26:22 +02:00
Daniel García Aubert
ef5049f28f Use destructuring assignment to improve readability 2017-09-15 14:07:46 +02:00
Daniel García Aubert
d5d9044686 Use const keyword to declare variables 2017-09-15 14:05:23 +02:00
Daniel García Aubert
5d632d936e Use ES6 class syntax 2017-09-15 14:04:09 +02:00
Daniel García Aubert
90c4796d4e Remove empty line 2017-09-15 13:41:54 +02:00
Daniel García Aubert
ada58f6ea2 Use const keyword to declare varibles 2017-09-15 13:35:00 +02:00
Daniel García Aubert
b4ce13e429 Use object shorthand notation 2017-09-15 11:56:59 +02:00
Daniel García Aubert
11f7b38c69 Do not use dot module to build column type query 2017-09-15 11:54:56 +02:00
Daniel García Aubert
9771979b8f Missing call to super class in constructor 2017-09-15 10:59:07 +02:00
Daniel García Aubert
c00a93f414 Use destruturing assignment to format the formula result 2017-09-15 10:58:11 +02:00
Daniel García Aubert
ecbc7a28e7 Declare constants with const keyword 2017-09-15 10:49:20 +02:00
Daniel García Aubert
68dfed8b85 Use ES6 class syntax 2017-09-15 10:48:44 +02:00
Daniel García Aubert
2437288d9d Replace widget word by dataview 2017-09-15 10:37:51 +02:00
Daniel García Aubert
9c64d674b3 Do not use underscore 2017-09-14 18:02:13 +02:00
Daniel García Aubert
a4ecc18f2f Use default values for constructor's arguments 2017-09-14 17:57:24 +02:00
Daniel García Aubert
1063d81c1b Rename debug namespace 2017-09-14 17:56:40 +02:00
Daniel García Aubert
dcb9b8ec52 Rename BaseWidget by BaseDataview 2017-09-14 17:56:17 +02:00
Daniel García Aubert
dbb23bf9f0 Remove jshint's complaints 2017-09-14 17:24:13 +02:00
Daniel García Aubert
2a0b15f085 Remove prefix '_' while passing context param to templates 2017-09-14 17:22:34 +02:00
Daniel García Aubert
d0e2c9f898 Use debug module to print sql for debugging purposes 2017-09-14 17:21:21 +02:00
Daniel García Aubert
d328b534a5 Replace widget word by dataview 2017-09-14 17:19:16 +02:00
Daniel García Aubert
050e9776d1 Use const for requirements, constants and variables that are initialized once 2017-09-14 17:18:20 +02:00
Daniel García Aubert
c8ff61c531 Use ES6 class syntax 2017-09-14 17:15:43 +02:00
Daniel García Aubert
cdc56e703c Rename BaseWidget by BaseDataview 2017-09-14 17:10:51 +02:00
Daniel García Aubert
9a4794ee10 Remove dot requirement and use template strings to build list aggregation query 2017-09-14 17:09:55 +02:00
Daniel García Aubert
51907b9545 Apply extract method to condition 2017-09-14 16:56:55 +02:00
Daniel García Aubert
1f3b0beddf Fix missing parameter 2017-09-14 16:47:05 +02:00
Daniel García Aubert
38e2c040d1 Use template string to escape literals 2017-09-14 16:45:45 +02:00
Daniel García Aubert
46860541fe Apply extract method to validate input options 2017-09-14 16:42:25 +02:00
Daniel García Aubert
c2e99219ef Use ES6 goodies to refactor format method 2017-09-14 16:30:46 +02:00
Daniel García Aubert
cc2cf78264 Rename all 'widget' ocurrences by 'dataview' 2017-09-14 16:12:39 +02:00
Daniel García Aubert
746292610a Rename debug namespace 2017-09-14 16:10:23 +02:00
Daniel García Aubert
b05083bcfc Move search's templates along aggregation's templates 2017-09-14 16:09:44 +02:00
Daniel García Aubert
cd13107a4d Use ES6 let & const to declare variables 2017-09-14 16:08:12 +02:00
Daniel García Aubert
46254eaf74 rename BaseWidget by BaseDataview 2017-09-14 15:59:15 +02:00
Daniel García Aubert
086eff01a9 Use ES6 class syntax 2017-09-14 15:57:18 +02:00
Daniel García Aubert
02949003a9 Build search query in two steps 2017-09-14 15:48:54 +02:00
Daniel García Aubert
0a894da0df Remove prefix to context's properties 2017-09-14 15:27:57 +02:00
Daniel García Aubert
e2ab48bee2 Remove prefix to context's properties 2017-09-14 15:22:58 +02:00
Daniel García Aubert
132fce84c5 Remove string template in the middle 2017-09-14 15:07:30 +02:00
Daniel García Aubert
b1508af007 Remove prefix to context's props in order to share it throught all templates avoiding to duplicate passing custom params again and again 2017-09-14 13:14:12 +02:00
Daniel García Aubert
65dca454f4 Move aggragation query to its own query template 2017-09-14 12:18:03 +02:00
Daniel García Aubert
3682740f08 Build aggregation query with string templates avoiding to join all inner templates 2017-09-14 12:01:41 +02:00
Daniel García Aubert
a434015d5b Move categories CTE template out of aggregation class 2017-09-14 11:27:03 +02:00
Daniel García Aubert
2f4f719f55 Use object properties in class method instead of passing them as parameters 2017-09-13 19:42:25 +02:00
Daniel García Aubert
75645e2d7a Use string templates to build categories CTE sql 2017-09-13 19:34:09 +02:00
Daniel García Aubert
4d1a53c20f Use string templates to build error message 2017-09-13 19:27:25 +02:00
Daniel García Aubert
ee471184b9 Use default values for input params 2017-09-13 19:19:25 +02:00
Daniel García Aubert
4518b7cb6e Declare requirement with const keyword 2017-09-13 19:17:16 +02:00
Daniel García Aubert
306df5be5a Replace underscore's function by ES6 equivalents 2017-09-13 19:16:08 +02:00
Daniel García Aubert
33e8657e35 Declare constants with const keyword 2017-09-13 18:40:09 +02:00
Daniel García Aubert
6fd3388fa2 Replace dot templates by ES6 string templates 2017-09-13 18:38:54 +02:00
Daniel García Aubert
4a89ad57d7 Remove '_' as prefix for template's context properties 2017-09-12 13:05:46 +02:00
Daniel García Aubert
c0cfdad7d1 Use hasOwnProperty method to check if histogram is a time-series 2017-09-12 10:38:53 +02:00
Daniel García Aubert
8f797c3c41 Fix EOF 2017-09-12 10:16:16 +02:00
Daniel García Aubert
2576c3e7d5 Rename _shouldOverrideRange & _shouldOverrideBins methods 2017-09-12 10:14:55 +02:00
Daniel García Aubert
3a936474cf Fix bad merge with master 2017-09-11 19:48:46 +02:00
Daniel García Aubert
a98f5bf08b Merge branch 'master' into time-series-refactor 2017-09-11 19:38:21 +02:00
Daniel García Aubert
03babcb43b Simplify condition and remove unused method 2017-09-11 19:31:38 +02:00
Daniel García Aubert
9aa5a9e850 Improve comment 2017-09-11 19:26:28 +02:00
Daniel García Aubert
e3bffcd39d Use inline functions to filter desired fields of the row 2017-09-11 19:24:01 +02:00
Daniel García Aubert
5fc2b46d56 Fix bad condition 2017-09-11 19:14:11 +02:00
Daniel García Aubert
7c69240748 Use parameter default value 2017-09-11 19:10:06 +02:00
Daniel García Aubert
ee43378c68 Use arrow function 2017-09-11 19:09:05 +02:00
Daniel García Aubert
09981c2560 Extract method to check valid aggregation 2017-09-11 18:57:16 +02:00
Daniel García Aubert
fd9534797c Minor refactors 2017-09-11 18:44:14 +02:00
Daniel García Aubert
38e7e71328 Implement template method pattern to format histogram query output 2017-09-11 17:19:02 +02:00
Daniel García Aubert
271932a80d Extract condition to a method 2017-09-11 17:17:42 +02:00
Daniel García Aubert
4f33e0d794 Rename Histogram.dataview by Histogram.histogramImplementation 2017-09-11 15:34:42 +02:00
Daniel García Aubert
ec23bfc79b Rename HistogramBase by BaseHistogram 2017-09-11 13:54:46 +02:00
Daniel García Aubert
6c3fa045cd Rename HistogramBase by BaseHistogram 2017-09-11 13:53:05 +02:00
Simon
d75ee965ae changing some 'var' to 'let/const' 2017-09-11 11:48:33 +02:00
Simon
5e9b2e45c7 creating HistogramBase with the common functions of NumericHistogram and DateHistogram 2017-09-11 11:32:20 +02:00
Simon
e4a20fa954 adding forgotten return 2017-09-08 17:57:35 +02:00
Simon
a20900210d removing unneeded _isDateHistogram function 2017-09-08 17:54:25 +02:00
Simon
2650c3b3e6 removing self=this assignment 2017-09-08 17:51:02 +02:00
Simon
25ef2610aa Varible declarations to let/const 2017-09-08 17:43:10 +02:00
Simon
92f6f59e07 Fix jshint style errors 2017-09-08 16:13:23 +02:00
Simon
5e07cc2ad1 Remove unneeded condittion 2017-09-08 16:06:54 +02:00
Simon
5593d92c4b Do not choose histogram implementation until getResult() 2017-09-08 15:55:23 +02:00
Simon
29f32cb9cc Expose dataview's methods to bypass concrete overview's implementations 2017-09-08 15:53:00 +02:00
Simon
1d4935cc9a Fix undefined while destrutcuring assignment 2017-09-08 15:50:01 +02:00
Simon
f75b4312a1 Fix undefined while destructuring assignment 2017-09-08 15:49:25 +02:00
Simon
23dd143fa5 Make Histogram class as context of state pattern 2017-09-08 12:48:08 +02:00
Simon
7d42afcdb4 remove unnecessary properties of NumericHistogram 2017-09-08 12:22:24 +02:00
Simon
78b95d05d0 make private functions 2017-09-08 12:21:22 +02:00
Simon
fb753e50a2 remove getOffset function 2017-09-08 12:19:05 +02:00
Simon
c863cdd9f6 remove getAggregation function 2017-09-08 12:17:29 +02:00
Simon
a4ebce52db remove unnecessary properties in format function 2017-09-08 12:16:56 +02:00
Simon
4a00a2d673 rename buildQueryTpl by _buildQueryTpl 2017-09-08 12:15:21 +02:00
Simon
38f0e23efe rename buildNumericHistogramQueryTpl by buildQueryTpl 2017-09-08 12:10:31 +02:00
Simon
7f14785091 fix namespace for debugging 2017-09-08 12:07:49 +02:00
Simon
db969a51ad make public some private functions 2017-09-08 12:07:07 +02:00
Simon
3441ad6aa9 rename _buildDateHistogramQueryTpl by _buildQueryTpl 2017-09-08 12:04:25 +02:00
Simon
347dea8f66 naming private functions 2017-09-08 12:01:15 +02:00
Simon
a3112aa929 fix function name in recursion 2017-09-08 11:55:28 +02:00
Simon
157946cc42 Rename DateHistogram class 2017-09-08 11:54:30 +02:00
Simon
8ce25d958c fix namespace for debugging 2017-09-08 11:53:47 +02:00
Daniel García Aubert
7e099be134 Add specific implementations of histograms based on column type; still not used 2017-09-08 10:29:54 +02:00
Javier Torres
6b2e2b2241 Stub next release (package.json) 2017-09-07 16:00:27 +02:00
Javier Torres
855e5c9e4c Stub next release 2017-09-07 15:59:32 +02:00
Javier Torres
a24792f46d Release 3.12.9 2017-09-07 15:57:11 +02:00
Javier Torres
0eb57f6801 Merge pull request #743 from CartoDB/718-quantiles_turbo_carto
Do not use distinct when calculating quantiles
2017-09-07 15:55:47 +02:00
Javier Torres
f1246cb060 Bump to 3.12.9 2017-09-07 15:54:43 +02:00
Javier Torres
7dd5c5b15d Do not use distinct when calculating quantiles 2017-09-07 14:39:25 +02:00
Ivan Malagon
806c13beac Release 3.12.8 2017-09-07 10:51:23 +02:00
Ivan Malagon
69f110e037 Merge pull request #742 from CartoDB/fix-histogram-out-of-range
Fix out of range bug in date histograms
2017-09-07 10:49:49 +02:00
Ivan Malagon
d77075295e Update version and NEWS 2017-09-07 10:48:21 +02:00
Daniel García Aubert
63a7ee08d0 Avoid nested ternaries for date histograms 2017-09-06 19:15:39 +02:00
Daniel García Aubert
b63a67a5b8 Avoid nested ternaries 2017-09-06 18:33:51 +02:00
Daniel García Aubert
1ac8455dc2 Use template strings to build histogram query 2017-09-06 18:13:34 +02:00
Daniel García Aubert
9f52e58be8 Rename BaseWidget by BaseDataview 2017-09-06 16:54:08 +02:00
Daniel García Aubert
4edf18f77a Remove underscore requirement 2017-09-06 16:52:17 +02:00
Daniel García Aubert
b5d2de8edc Do not use _.omit() 2017-09-06 16:49:00 +02:00
Ivan Malagon
bd8d147a7d Fix out of range bug in date histograms 2017-09-06 16:21:01 +02:00
Daniel García Aubert
8ac041805c Use typeof !== string instead of underscore's equivalent 2017-09-06 16:20:01 +02:00
Daniel García Aubert
6e0dc8666d Use .hasOwnProperty() instead of underscore's equivalent 2017-09-06 16:14:29 +02:00
Daniel García Aubert
3e55bd2abb Make happy to jshint 2017-09-06 15:56:52 +02:00
Daniel García Aubert
da1d0550f6 Use const keyword for constants 2017-09-06 15:52:13 +02:00
Daniel García Aubert
c37ef36a61 Move parseOffset function to a class method 2017-09-06 15:49:05 +02:00
Daniel García Aubert
9e3e1cad9a Move getWidth function to a class method 2017-09-06 15:47:21 +02:00
Daniel García Aubert
e84f30488f Move getBinsCount function to a class method 2017-09-06 15:45:51 +02:00
Daniel García Aubert
49a60caffc Move getBinEnd function to a class method 2017-09-06 15:42:29 +02:00
Daniel García Aubert
392e004879 Move getBinStart and populateBinStart function to a class method 2017-09-06 15:38:23 +02:00
Daniel García Aubert
288656301b Move getOffset function to a class method 2017-09-06 15:37:28 +02:00
Daniel García Aubert
96740b82ed Move getAggregation function to a class method 2017-09-06 13:52:02 +02:00
Daniel García Aubert
1be66e1552 Use const for requirements 2017-09-06 13:47:19 +02:00
Daniel García Aubert
5ba2dfbbd6 Use ES6 class syntax 2017-09-06 13:43:54 +02:00
Daniel García Aubert
af4b3d81cd make happy to jshint 2017-09-06 11:55:40 +02:00
Daniel García Aubert
bbd42b73f2 Remove dot requirement 2017-09-06 11:44:52 +02:00
Daniel García Aubert
8e2535745e Use template string for columnCastTpl 2017-09-06 11:44:25 +02:00
Daniel García Aubert
4f75f6c07b Use template string for dateBinsQueryTpl and dateHistogramQueryTpl 2017-09-06 11:41:24 +02:00
Daniel García Aubert
0ede3013db Use template string for dateOverrideBasicsQueryTpl 2017-09-06 10:57:38 +02:00
Daniel García Aubert
0b79ac76db Use template string for dateBasicsQueryTpl 2017-09-06 10:39:17 +02:00
Daniel García Aubert
2739364193 Use template string for histogramQueryTpl 2017-09-05 15:53:21 +02:00
Daniel García Aubert
adcff54589 Use template string for nansQueryTpl 2017-09-05 15:53:06 +02:00
Daniel García Aubert
734cfa6d83 Fix undefined argument 2017-09-05 15:51:31 +02:00
Daniel García Aubert
7ea6b3e371 Use template string for infinitiesQueryTpl 2017-09-05 12:21:30 +02:00
Daniel García Aubert
f1018f3272 Use template string for nullsQueryTpl 2017-09-05 12:18:42 +02:00
Daniel García Aubert
151bdec1fd Use template string for overrideBinsQueryTpl 2017-09-05 12:16:38 +02:00
Daniel García Aubert
5d413ac1f9 Use template string for overrideBasicsQueryTpl 2017-09-05 11:26:38 +02:00
Daniel García Aubert
37b1376767 Fix bad find & replace 2017-09-05 11:26:27 +02:00
Daniel García Aubert
00741bc0a4 Use template string for basicsQueryTpl 2017-09-05 10:41:48 +02:00
Daniel García Aubert
c580600590 Extract template to filter out special numeric values 2017-09-05 10:36:18 +02:00
Daniel García Aubert
6373fe8652 Use template string for filteredQueryTpl 2017-09-04 19:01:58 +02:00
Daniel García Aubert
5ce419d863 Use template string for dateIntervalQueryTpl 2017-09-04 18:42:30 +02:00
Mario de Frutos
7be5361433 Upgrade to camshaft 0.58.1 (#739) 2017-09-01 11:31:06 +02:00
Mario de Frutos
5332fd3baa Stubs next version 2017-08-31 10:21:00 +02:00
Mario de Frutos
77f1aa7e0c Update to camshaft 0.58.0 (#737) 2017-08-31 10:12:58 +02:00
Raul Ochoa
e1990fc2f9 Use the correct fixture image 2017-08-29 13:29:39 +00:00
Raul Ochoa
ca6eb609b2 Update news 2017-08-29 13:08:14 +00:00
Raul Ochoa
91ce3a5489 Going green: allow to use bbox param, along lon, lat, and zoom
The `bbox` param was removed from the base controller, the rest kept
working as they are declared in the base, but it's better to declare
them here as well.

Fixes #735.
2017-08-29 13:05:03 +00:00
Raul Ochoa
fc0dbaaab1 Going red: Bounding box parameter ignored in static named maps 2017-08-29 13:04:20 +00:00
Mario de Frutos
03dc260104 Stubs new version 2017-08-24 12:09:51 +02:00
Mario de Frutos
d644376f88 Update to camshaft 0.57.0 (#733)
* Update to camshaft 0.57.0

* Yarn.lock with update to camshaft 0.57.0
2017-08-24 12:07:43 +02:00
Mario de Frutos
ed0bfa5f63 Stubs next version 2017-08-23 16:53:01 +02:00
Mario de Frutos
ca0b927f51 Update camshaft to 0.56.0 (#731) 2017-08-23 16:34:42 +02:00
Simon
cd27d6aa02 Stub NEWS/package for next version 2017-08-22 16:37:23 +02:00
Simon
7aefca3f82 updating NEWS.md 2017-08-22 16:26:36 +02:00
Simon Martín
3d409274e0 Merge pull request #730 from CartoDB/upgrade-camshaft
Upgrade camshaft to 0.55.8

All working fine in local and staging
2017-08-22 16:13:06 +02:00
Raul Ochoa
4491fa2faf Upgrade camshaft to 0.55.8 2017-08-22 14:17:17 +02:00
Raul Ochoa
0ed46930dd Stubs next version 2017-08-16 15:37:29 +02:00
Raul Ochoa
f3b7a857f2 Release 3.12.2 2017-08-16 15:36:16 +02:00
Raul Ochoa
3a22adf966 Update news 2017-08-16 15:35:34 +02:00
Raul Ochoa
1c6a76af72 Merge pull request #726 from CartoDB/725-polygon-count
725 fix polygon count
2017-08-16 15:33:19 +02:00
Raul Ochoa
175d3ac317 Merge pull request #728 from CartoDB/fix-test-gauge-error
Restore statsClient after performing test
2017-08-16 15:32:14 +02:00
Simon
175d070f09 using const instead of let and var and adding assert.ifError 2017-08-16 10:07:27 +02:00
Raul Ochoa
339f1aafa9 Stubs next version 2017-08-13 17:56:23 +02:00
Raul Ochoa
fef0dc302a Release 3.12.1 2017-08-13 17:55:45 +02:00
Raul Ochoa
58fec46117 Merge pull request #729 from CartoDB/upgrade-deps
Upgrades cartodb-psql, windshaft, and camshaft
2017-08-13 17:54:53 +02:00
Raul Ochoa
7be74d6ce1 Upgrades cartodb-psql, windshaft, and camshaft 2017-08-13 17:40:06 +02:00
Daniel García Aubert
d0f5ebd7ab Restore statsClient after performing test 2017-08-11 17:55:55 +02:00
Simon
92d33bf7fd linter details for polygons count test 2017-08-10 18:20:15 +02:00
Daniel García Aubert
490adbce4b Stubs next version 2017-08-10 18:19:20 +02:00
Simon
fab7832dee added ascii art for polygons count test 2017-08-10 18:16:53 +02:00
Simon
e678957a8f move polygon count test to widgets regression testfile, and check the only returned polygon is the expected one 2017-08-10 18:09:18 +02:00
Daniel García Aubert
e1e22de65f Release 3.12.0 2017-08-10 17:54:09 +02:00
Daniel
43312922fc Merge pull request #717 from CartoDB/response-time-limit
[limits] Response time limits
2017-08-10 17:35:47 +02:00
Daniel García Aubert
01a22a45bb Move setUserDatabaseTimeoutLimit from class method to a instance method 2017-08-10 17:09:05 +02:00
Raul Ochoa
9524433437 Use instance server 2017-08-10 16:24:40 +02:00
Raul Ochoa
14d5ee4178 Remove user param 2017-08-10 16:22:45 +02:00
Raul Ochoa
e7c206762d String comparison and regex to match errors instead of indexOf 2017-08-10 16:09:26 +02:00
Raul Ochoa
69eaa72819 String comparison and regex to match errors instead of indexOf 2017-08-10 16:06:10 +02:00
Raul Ochoa
23edf78a67 Remove unnecessary step 2017-08-10 15:58:25 +02:00
Simon
44c5eb051d formatting the query of polygon count test 2017-08-10 11:05:36 +02:00
Simon
814b123b2b fix 725 using the ST_Intersects function instead of && 2017-08-09 18:55:14 +02:00
Simon
ff560ffde7 add test boundingBox-polygon-counter 2017-08-09 18:49:59 +02:00
Daniel García Aubert
14f85abd39 Merge branch 'master' into response-time-limit 2017-08-09 18:48:38 +02:00
Daniel García Aubert
ce97844f37 Upgrade windshaft version to 3.3.0 2017-08-09 18:42:44 +02:00
Daniel García Aubert
d27a281067 Upgrade cartodb-redis to 0.14.0 2017-08-09 17:55:39 +02:00
Daniel García Aubert
3611752677 Stubs next version 2017-08-08 11:25:18 +02:00
Daniel García Aubert
b24858a17c Release 3.11.0 2017-08-08 11:21:44 +02:00
Daniel
26a967d0a7 Merge pull request #723 from CartoDB/fix-time-series-issues
Fix time series issues
2017-08-08 10:51:13 +02:00
Daniel García Aubert
c643160671 Prefix date interval query (to calculate automatic aggregation) to avoid name collision 2017-08-08 10:32:53 +02:00
Daniel García Aubert
e7a0b246a3 Prefix with double underscore 2017-08-08 10:20:36 +02:00
Daniel García Aubert
3c061769c6 Prefix basics columns to avoid name collision 2017-08-08 10:11:35 +02:00
Daniel García Aubert
7e159c565b Prefix iqr query calculation to avoid name collision 2017-08-08 10:03:40 +02:00
Daniel García Aubert
ff3d7ed7b2 Fix jshint typo 2017-08-08 09:57:12 +02:00
Daniel García Aubert
cf71489a7f Prefix nans and infinities counters to avoid name collision 2017-08-08 09:54:49 +02:00
Daniel García Aubert
c7e5dbf158 Fix query aliases 2017-08-08 09:46:34 +02:00
Daniel García Aubert
34cf45bc9d Prefix infinities query to avoid name collision 2017-08-08 09:43:31 +02:00
Daniel García Aubert
7e058955ea Use final naming to group by 2017-08-08 09:39:51 +02:00
Daniel García Aubert
a9e3bc3cda Prefix filtered source to avoid name collision 2017-08-08 09:36:23 +02:00
Daniel García Aubert
3ee064a59f Prefix nulls query to avoid name collision 2017-08-08 09:32:13 +02:00
Daniel García Aubert
f3ababffc1 Prefix bins query to avoid name collision 2017-08-08 09:12:52 +02:00
Daniel García Aubert
0f8de9e74b Add prefix to basics query to avoid name collision 2017-08-08 09:06:36 +02:00
Daniel García Aubert
91d5a0e4e4 Remove column avg_val in group_by 2017-08-08 08:46:26 +02:00
Daniel García Aubert
e446160151 Use final columns to group by 2017-08-08 08:45:05 +02:00
Daniel García Aubert
823925d091 Add prefix to bins_array to avoid name collision 2017-08-08 08:41:22 +02:00
Daniel García Aubert
994e58bef7 Add prefix to bins_number and nulls_cout to avoid name collision 2017-08-08 08:33:26 +02:00
Daniel García Aubert
5c80ff8191 Extract query: move condition to a method 2017-08-07 19:24:15 +02:00
Daniel García Aubert
0f45675652 Update NEWS 2017-08-07 19:06:31 +02:00
Daniel García Aubert
b2bbc329ea Apply prefix for intermediate query variables to avoid name colision 2017-08-07 19:03:49 +02:00
Daniel García Aubert
2024e89c6a Update news 2017-08-07 18:30:17 +02:00
Daniel García Aubert
1f8da14c2a Cast to timestamp start_date and end_date to calculate bins when date column is timestamptz 2017-08-07 18:27:24 +02:00
Daniel García Aubert
660078f284 Fix minor issues with timezones 2017-08-07 16:53:08 +02:00
Raul Ochoa
e9d925334c Move layergroup-token to models
We will share it between tests and a middleware to parse the token.
2017-08-04 17:51:10 +02:00
Raul Ochoa
399561d076 Implement LZMA query param inflating as middleware
The req2params method is doing too many things,
this is an initial step to do fewer things in that method.
2017-08-04 17:30:46 +02:00
Daniel García Aubert
7eae2a0618 Stubs next version 2017-08-04 09:51:16 +02:00
Daniel García Aubert
e52cf0960c Release 3.10.1 2017-08-04 09:46:00 +02:00
Daniel García Aubert
c39a6a6806 Update news 2017-08-04 09:42:21 +02:00
Javier Goizueta
82cab3ccc7 Merge pull request #719 from CartoDB/ramp-infinities-nans
Exclude Infinities & NaNs from ramps
2017-08-04 09:38:44 +02:00
Javier Goizueta
e01730e8e4 Syntax fixes 2017-08-03 19:16:08 +02:00
Javier Goizueta
eed33fc76d Add tests for excluding NaNs, Ininities from ramps 2017-08-03 19:07:02 +02:00
Daniel
2a531024d7 Merge pull request #720 from CartoDB/fix-aggregation-falsy-values
Fix bad condition when timestampt_start has falsy values
2017-08-03 18:36:37 +02:00
Daniel García Aubert
48ad7059e1 Going green: do not rely on falsy conditional 2017-08-03 18:23:55 +02:00
Daniel García Aubert
6c063095a3 Going red: aggregation is undefined when automattic mode is enabled and timestamp start is 1970-01-01 (epoch) 2017-08-03 18:18:35 +02:00
Daniel García Aubert
1d1a046439 Stubs next version 2017-08-03 15:33:32 +02:00
Daniel García Aubert
fe7a2451ef Release 3.10.0 2017-08-03 15:25:47 +02:00
Daniel
a696bdc723 Merge pull request #706 from CartoDB/705-special-numeric-values
Support special numeric values for json responses
2017-08-03 15:21:29 +02:00
Daniel
a98c884e1a Merge pull request #698 from CartoDB/691-date-histogram
Support histograms with date/time expressions for aggregations
2017-08-03 15:16:13 +02:00
Daniel García Aubert
431ca9c56f Update NEWS 2017-08-03 15:15:37 +02:00
Daniel García Aubert
b56d2ec30b Validate aggregation value 2017-08-03 12:24:05 +02:00
Daniel García Aubert
90ded34af7 Do not fail if layergroup is undefined 2017-08-03 12:22:30 +02:00
Daniel García Aubert
7fed91900d Handle error 2017-08-03 12:19:34 +02:00
Javier Goizueta
b4799124e6 Exclude non-finite values when computing ramps 2017-08-02 17:28:46 +02:00
Daniel García Aubert
1bc5c04489 Remove unused method 2017-08-02 13:15:40 +02:00
Daniel García Aubert
0a57e86cb8 Do not build data histogram infinitely when overriding aggregation with auto mode 2017-08-02 12:06:10 +02:00
Daniel García Aubert
3574700c2d Remove tiler render limit 2017-08-02 11:07:44 +02:00
Daniel García Aubert
ab879e2634 Use new version of getUserTimeoutRenderLimits 2017-08-01 19:13:55 +02:00
Daniel García Aubert
9034508244 Support automattic aggregation only when aggregation para is set to 'auto' 2017-08-01 17:15:45 +02:00
Daniel García Aubert
b2b68ffd5c Merge branch 'master' into 691-date-histogram 2017-08-01 16:07:27 +02:00
Daniel García Aubert
0594407b38 Change error message 2017-08-01 15:03:09 +02:00
Daniel García Aubert
262f854e68 Remove error wrapping 2017-08-01 13:10:55 +02:00
Daniel García Aubert
9258ad7ecc Fix style typo 2017-08-01 12:56:03 +02:00
Daniel García Aubert
46fee774bd Fix misconfiguration in test's hook 2017-08-01 12:54:41 +02:00
Daniel García Aubert
05ddf1d505 Add test to check if asset fallback is working when enabled and database timeout erro happens 2017-08-01 12:53:29 +02:00
Daniel García Aubert
4c3e3005aa Apply asset fallback to database timeout errors 2017-08-01 12:52:34 +02:00
Daniel García Aubert
7d13603163 Implement test to validate database timeout error for static api 2017-08-01 11:58:43 +02:00
Daniel García Aubert
40af73d524 Implement test to check render timeout error for static api 2017-08-01 11:47:50 +02:00
Daniel García Aubert
91b3e373b7 Add helper method to fetch static images 2017-08-01 11:46:48 +02:00
Daniel García Aubert
aa4bb62f38 Fix test 2017-08-01 10:29:46 +02:00
Daniel García Aubert
9af372381c Fix content-type assertion 2017-08-01 10:29:29 +02:00
Daniel García Aubert
0c4e67d6a8 Implemented database timeout test while requesting tiles 2017-08-01 10:21:39 +02:00
Daniel García Aubert
dd5209b9a7 Add torque.png timeout error test 2017-08-01 09:39:37 +02:00
Daniel García Aubert
44fc34b1ce Improve timeout error message 2017-07-31 20:07:31 +02:00
Daniel García Aubert
1fdc0621e7 Categorize timeout errors 2017-07-31 19:36:07 +02:00
Daniel García Aubert
5974413d5c Use 429 to indicate timeout errors 2017-07-31 19:08:29 +02:00
Daniel García Aubert
bb59902535 Refactoring tests hooks 2017-07-31 18:52:09 +02:00
Daniel García Aubert
49d2f513c6 Fix typo 2017-07-31 18:51:23 +02:00
Daniel García Aubert
b1114fc606 Add timeout test for toque.json tiles 2017-07-31 18:26:45 +02:00
Daniel García Aubert
227c2b336b Uncomment database timeout configuration 2017-07-31 18:25:34 +02:00
Daniel García Aubert
ac7509b01a Expose function to clean up database connections 2017-07-31 18:24:42 +02:00
Daniel García Aubert
9b5482489e Fix content-type defaults 2017-07-31 18:23:17 +02:00
Daniel García Aubert
f079c24554 Use parsed body variable 2017-07-31 18:22:13 +02:00
Daniel García Aubert
04da57fe0c Do not create layergroup if it is already provided 2017-07-31 18:14:32 +02:00
Daniel García Aubert
aa6d01f151 Add timeout test for attributes 2017-07-31 18:12:33 +02:00
Daniel García Aubert
435d902e45 Expose function to clean all database connections in the pool 2017-07-31 18:10:14 +02:00
Daniel García Aubert
664db4b5cf Pass proper param to check content-type and status 2017-07-31 18:07:44 +02:00
Daniel García Aubert
64f19b65ec Remove attributes param 2017-07-31 18:01:19 +02:00
Daniel García Aubert
398369a5c7 Do not rely on expected defaults headers 2017-07-31 17:58:33 +02:00
Daniel García Aubert
f2e043b063 Do not expose database error info 2017-07-31 17:56:58 +02:00
Daniel García Aubert
6936107b68 Adjust pg_sleep to timeout 2017-07-28 16:04:11 +02:00
Daniel García Aubert
c3e137bb00 Update dependency 2017-07-28 16:02:54 +02:00
Daniel García Aubert
cca570e832 Uncomment DB and role configuration 2017-07-28 13:23:13 +02:00
Daniel García Aubert
815eac5a48 Add hook to refresh all connections in the pool 2017-07-28 13:22:16 +02:00
Daniel García Aubert
b023a155b7 Be more accurate with timeouts and pg_sleep 2017-07-28 13:21:17 +02:00
Daniel García Aubert
33e77a42f2 Separate user timeout suites between render and database 2017-07-27 18:50:27 +02:00
Daniel García Aubert
664a4e673a Add missing after-each hooks and merged duplicates 2017-07-27 17:08:29 +02:00
Daniel García Aubert
eba97a41e5 Going green, solves issue with role timeout in database 2017-07-27 16:30:57 +02:00
Daniel García Aubert
9e491e7e9a Fix tests names 2017-07-27 16:29:36 +02:00
Daniel García Aubert
522fc79d71 Do not remove redis' keys if layergroup was not created 2017-07-27 12:46:38 +02:00
Daniel García Aubert
768d06c582 Assert layer params is defined but mapnik layers 2017-07-26 18:35:40 +02:00
Daniel García Aubert
058f19ab36 Fix skipped test 2017-07-26 13:27:58 +02:00
Daniel García Aubert
788b2f0683 Implement test to validate response limits work as expected 2017-07-25 19:16:37 +02:00
Daniel García Aubert
526e850f26 Add method to set statements timeout for user's role and database 2017-07-25 19:15:43 +02:00
Daniel García Aubert
444595d49d Rely on windshaft's repo branch 2017-07-25 19:14:04 +02:00
Daniel García Aubert
eee4fc815e Do not expose database error details 2017-07-25 19:11:56 +02:00
Daniel García Aubert
edacd85d5c Merge branch 'master' into response-time-limit 2017-07-24 11:47:51 +02:00
Daniel García Aubert
52da3bfa55 Stub next version 2017-07-21 11:05:51 +02:00
Daniel García Aubert
35b9448e9a Release 3.9.8 2017-07-21 10:58:37 +02:00
Daniel
9959e009eb Merge pull request #714 from CartoDB/bump-windshaft-3.2.2
Bump windshaft version to 3.2.2
2017-07-21 10:44:35 +02:00
Daniel García Aubert
106b9a64b2 Update NEWS 2017-07-21 10:39:33 +02:00
Daniel García Aubert
42d05f29ee Bump windshaft version to 3.2.2 2017-07-20 19:47:01 +02:00
Daniel García Aubert
fc3a959da1 Stub next version 2017-07-20 15:00:39 +02:00
Daniel García Aubert
20003c49ce Release 3.9.7 2017-07-20 14:53:20 +02:00
Daniel
d1d9401539 Merge pull request #713 from CartoDB/upgrade-turbo-carto-to-0.19.2
Bump turbo-carto version to 0.19.2
2017-07-20 14:50:02 +02:00
Daniel García Aubert
cc8a1df388 Bump turbo-carto version to 0.19.2 2017-07-20 12:11:09 +02:00
Daniel García Aubert
e9bc0732c0 Use switch statement instead of if ... else if ... else ... 2017-07-19 12:33:57 +02:00
Daniel García Aubert
8907082a85 Parse body relying on content-type header 2017-07-19 12:24:37 +02:00
Daniel García Aubert
87eb5407a8 WIP: implement timeout limit for raster 2017-07-18 20:50:31 +02:00
Daniel García Aubert
a17916488b Update config to get the right key to enable stats metadate after layergroup creation 2017-07-18 17:40:36 +02:00
Daniel García Aubert
669707b26c Fix typo 2017-07-18 11:56:54 +02:00
Daniel García Aubert
40dc94e010 Merge branch 'master' into response-time-limit 2017-07-18 11:25:23 +02:00
Daniel
868930de46 Merge pull request #712 from CartoDB/mvt-no-content
Respond with 204 when mvt is empty
2017-07-18 11:23:12 +02:00
Daniel García Aubert
f306c26da6 Update News 2017-07-18 11:08:39 +02:00
Daniel García Aubert
446e2d0802 Add empty line at the end of file 2017-07-18 11:05:45 +02:00
Daniel García Aubert
0aab434f13 Remove duplicated assertion 2017-07-18 10:52:24 +02:00
Daniel García Aubert
ff13996255 Add test to check that mvt returns 200 when tile has data 2017-07-18 10:44:27 +02:00
Daniel García Aubert
eccc3597aa Respond with 204 when vector tile is empty 2017-07-17 19:44:18 +02:00
Carlos Matallín
6766b76545 Merge pull request #710 from CartoDB/691-date-histogram-offset
replace timezone => offset
2017-07-14 18:47:23 +02:00
Carlos Matallín
e30b883906 Merge branch '691-date-histogram' into 691-date-histogram-offset 2017-07-14 18:38:13 +02:00
Carlos Matallín
70b4d5b7fd replace timezone => offset 2017-07-14 18:30:36 +02:00
Daniel García Aubert
0fffafa1db Add timestamp_start in histogram summary to help to build the histogram in frontend side 2017-07-14 18:22:05 +02:00
Daniel García Aubert
21b8655f85 Return timezone applied or 0 if not present 2017-07-13 19:42:22 +02:00
Daniel García Aubert
c8286233be Do not apply timezone for minute an hour aggregations 2017-07-12 17:08:55 +02:00
Daniel García Aubert
b67f6053e8 Should respect first timestamp as bin_start 2017-07-12 15:19:28 +02:00
Daniel García Aubert
967dca9578 Improve readability 2017-07-12 15:10:39 +02:00
Daniel García Aubert
a35b1e3e86 Stubs next version 2017-07-11 09:59:30 +02:00
Daniel García Aubert
5b8ecd3df0 Release 3.9.6 2017-07-11 09:53:12 +02:00
Daniel
5ea5c1b2dc Merge pull request #708 from CartoDB/11245-aggregation-search
widgets: support for aggregation in search results
2017-07-11 09:44:33 +02:00
Daniel García Aubert
e36266a80f Added test to check all aggregation operations work as expected when searching dataviews 2017-07-10 12:29:25 +02:00
Carlos Matallín
b1c9dd537e Update Makefile 2017-07-07 17:47:28 +02:00
Carlos Matallín
dd934a3913 linter 2017-07-07 17:44:32 +02:00
Carlos Matallín
7fa154c062 widgets: add aggregation for search results, specs 2017-07-07 17:38:15 +02:00
Carlos Matallín
f7a763b637 widgets: add aggregation for search results 2017-07-07 17:09:17 +02:00
Daniel García Aubert
ad1506ae97 Remove empty lines 2017-07-06 16:24:50 +02:00
Daniel García Aubert
32bcf9ca89 Fix jshint typo 2017-07-06 16:24:18 +02:00
Daniel García Aubert
23aab7a09f User feature branch of cartodb-redis 2017-07-06 16:23:42 +02:00
Daniel García Aubert
37c970903e Avoid uncaught exception when layergroup is not present 2017-07-05 19:09:14 +02:00
Daniel García Aubert
0684c1b9d3 Work in progress: get timeout from redis 2017-07-05 19:08:19 +02:00
Daniel García Aubert
468f641af8 Going green: automatic mode works with dates 2017-06-29 16:57:27 +02:00
Daniel García Aubert
6d2934b30b Going red: add test to check automatic mode works with dates 2017-06-29 16:53:52 +02:00
Daniel García Aubert
7018af18b6 Support automatic aggregation for time-series histogram 2017-06-28 19:58:45 +02:00
Daniel García Aubert
f507f7a74b Stub next version 2017-06-27 17:18:08 +02:00
Daniel García Aubert
2f1cacdfc7 Release 3.9.5 2017-06-27 17:07:52 +02:00
Daniel García Aubert
3a442bea44 Update NEWS 2017-06-27 17:06:24 +02:00
Daniel
49f5b0b480 Merge pull request #700 from CartoDB/dataviews-special-float-values
Handle Infinity and NaN values for dataviews
2017-06-27 16:58:44 +02:00
Daniel García Aubert
01027b73da Fix jshint typo 2017-06-27 14:36:18 +02:00
Daniel García Aubert
af42fba53b Check that quarter aggreagtion uses filters properly in date histogram dataview 2017-06-27 14:28:23 +02:00
Daniel García Aubert
3e12bfe27a Going green: support special numeric values for json responses 2017-06-27 11:53:22 +02:00
Daniel García Aubert
13764e18ce Going red: attributes service do not support special numeric values (Infinity, -Infinity, NaN) 2017-06-27 11:21:05 +02:00
Javier Goizueta
b2f3735e95 The formula widget wasn't using the no_filters query for checking column types 2017-06-23 18:59:51 +02:00
Javier Goizueta
166e29e8ce Forward queries parameter from overview dataviews to base dataviews 2017-06-23 16:53:16 +02:00
Daniel García Aubert
32274e66fd Dataview formula: count infinities and nans as we do with nulls 2017-06-23 12:24:22 +02:00
Rafa de la Torre
15b88c6a67 Stub next version 2017-06-22 18:26:33 +02:00
Rafa de la Torre
2dae09c35b Fix yarn.lock and update HOWTO_RELEASE
In previous commit I updated all the dependencies with the newest
versions when I really intended to update just one. After asking the
node gurus we agreed on changing the docs to reflect a less aggressive
strategy for dependency upgrades.
2017-06-22 18:11:58 +02:00
Daniel García Aubert
a6daca9628 Support date histograms using timestamp with and without timezones 2017-06-22 18:04:23 +02:00
Rafa de la Torre
14e71b929a Release version 3.9.4 2017-06-22 17:48:55 +02:00
Daniel García Aubert
6f7cb75256 Fix bad datetime conversion 2017-06-21 20:19:02 +02:00
Daniel García Aubert
5555b8ad8e Going green: support numeric NaN values for dataviews 2017-06-21 18:59:36 +02:00
Daniel García Aubert
e44d418db3 Going red: Add test to check that aggregation dataview supports numeric special value 2017-06-21 18:44:21 +02:00
Ivan Malagon
6bfedef7eb Cast histogram width bucket to timestamp 2017-06-19 12:47:08 +02:00
Daniel García Aubert
77cb3dbbdc Merge branch 'master' into 691-date-histogram 2017-06-19 10:59:28 +02:00
Daniel García Aubert
17aebf53e2 Merge branch 'master' into dataviews-special-float-values 2017-06-19 10:58:13 +02:00
Daniel García Aubert
02f117af1b Merge branch 'dataviews-special-float-values' of github.com:CartoDB/Windshaft-cartodb into dataviews-special-float-values 2017-06-16 13:01:39 +02:00
Daniel García Aubert
b1ac5b8ca9 Handle special float values only if column is float 2017-06-16 12:57:46 +02:00
Mario de Frutos
e2b976d9d0 Fix version 2017-06-16 11:16:17 +02:00
Mario de Frutos
8e95cf20c0 Upgrade camshaft to 0.55.5 (#703) 2017-06-16 11:13:40 +02:00
Daniel García Aubert
20d7f1a7c5 Handle special float values only when aggregation columns is float (overviews) 2017-06-15 19:22:26 +02:00
Daniel García Aubert
115d8fe685 Handle special float values only when aggregation columns is float 2017-06-15 19:07:31 +02:00
Mario de Frutos
2a366ec16f Stubs next version 2017-06-15 18:32:28 +02:00
Mario de Frutos
849caf9b58 Upgrade to cammshaft 0.55.4 (#702) 2017-06-15 18:30:13 +02:00
Daniel García Aubert
ad570ab6f2 Use dataview base to get column type in formula dataviews 2017-06-15 18:04:35 +02:00
Daniel García Aubert
443c1100d7 Formula dataview: support special values only if column is a float column 2017-06-15 16:31:31 +02:00
Daniel García Aubert
7d0af4e259 Going green: handle special float values for formula when overviews are involved 2017-06-14 19:44:48 +02:00
Daniel García Aubert
81f60959e5 Going green: handle special float values for formula when overviews are involved 2017-06-14 19:20:39 +02:00
Daniel García Aubert
ef849aec34 Going red: add test to check that special float values are not being filtered out in formula dataview when the layer uses overviews 2017-06-14 19:19:08 +02:00
Daniel García Aubert
dee00e6abd Going green: handle special float values for histogram when overviews are involved 2017-06-14 19:00:37 +02:00
Daniel García Aubert
06d40e8b1e Going red: add test to check that special float values are not being filtered out when the layer uses overviews 2017-06-14 18:57:32 +02:00
Daniel García Aubert
3f17c8b15a Filter out special float values before categorizing them 2017-06-14 15:05:46 +02:00
Daniel García Aubert
668b22628c Going green: support special float values in aggergation dataview with overviews 2017-06-13 19:01:59 +02:00
Daniel García Aubert
c08db78a0b Going red: implement test to check aggregation with overviews support special float values 2017-06-13 19:01:28 +02:00
Daniel García Aubert
551b6d409a Remove bad condition 2017-06-13 09:44:53 +02:00
Daniel García Aubert
3ae66e4143 Do not filter special values out if aggregation column is not defined 2017-06-13 09:30:43 +02:00
Daniel García Aubert
227937bf4c Remove test filter 2017-06-12 19:50:24 +02:00
Daniel García Aubert
cb7ec5d556 Fix jshint typos 2017-06-12 19:49:58 +02:00
Daniel García Aubert
8b2fa27ba7 Calculate aggregation filtering out special float values 2017-06-12 19:45:06 +02:00
Daniel García Aubert
962fa05574 Remove console 2017-06-12 19:28:49 +02:00
Daniel García Aubert
75d07745e6 Improve readability 2017-06-12 19:22:37 +02:00
Daniel García Aubert
7b5111614c Summarize special float values for ranked aggregation 2017-06-12 19:21:41 +02:00
Daniel García Aubert
e60bb770db Summarizes infinity and NaN values 2017-06-12 18:55:33 +02:00
Daniel García Aubert
ba6dc62a38 Going red: implementet test to check special float values support 2017-06-12 18:15:39 +02:00
Daniel García Aubert
e6aededf08 Fix typo 2017-06-12 17:19:05 +02:00
Daniel García Aubert
0aae29fb4b Fix jshint typo 2017-06-09 15:28:18 +02:00
Daniel García Aubert
9ba65bd5a4 Going green: Fix test for formula overviews flavour 2017-06-09 15:18:52 +02:00
Daniel García Aubert
7a3498e8ec Going red: formula does not work with Infinity or NaN values 2017-06-09 12:17:16 +02:00
Daniel García Aubert
fe5c76d65b Remove jshint hook 2017-06-08 19:25:05 +02:00
Daniel García Aubert
29a6658e3d Migrate dataviews endpoints to use the allow-query-params 2017-06-08 19:22:33 +02:00
Daniel García Aubert
2772fc62d2 Use a set/dict for checking the existence 2017-06-08 18:38:44 +02:00
Daniel García Aubert
0d4ac64f00 Merge branch 'master' into 691-date-histogram 2017-06-08 18:34:25 +02:00
Daniel
271887eb46 Merge pull request #696 from CartoDB/dataview-backend-small-refactor
Dataview backend small refactor
2017-06-08 18:24:59 +02:00
Daniel García Aubert
cd53eda0a5 Handle Infinity and NaN values for histograms 2017-06-08 16:01:41 +02:00
Daniel García Aubert
6c301403e3 Histogram going red: fails while quering Infinity and NanN values 2017-06-08 15:59:33 +02:00
Daniel García Aubert
47af013157 Merge branch 'master' into 691-date-histogram 2017-06-07 16:11:50 +02:00
Daniel García Aubert
35d4fb4d27 Improve readability, using extract method pattern 2017-06-07 16:11:09 +02:00
Daniel García Aubert
42e2f9e4b1 Update commented use cases 2017-06-07 15:54:28 +02:00
Daniel García Aubert
02bf1dd2d7 Release 3.9.1 2017-06-06 17:34:38 +02:00
Daniel
d365e092b9 Merge pull request #699 from CartoDB/update_camshaft_0553
Bump camshaft version to  0.55.3
2017-06-06 17:32:18 +02:00
Daniel García Aubert
45d1d07ea2 Use released version of comshaft (0.55.3) 2017-06-06 17:21:33 +02:00
Mario de Frutos
f14a61528a Upgrade to camshaft 0.55.3 2017-06-06 10:52:37 +02:00
Daniel García Aubert
d3bcf6f80d Do not omit nonexistent property 2017-06-06 09:15:49 +02:00
Daniel García Aubert
eeea51e10d Removed unused column in group by statement 2017-06-05 17:26:37 +02:00
Daniel García Aubert
9337cd948c Fix typo 2017-06-05 16:26:29 +02:00
Daniel García Aubert
527e005952 Merge branch '691-date-histogram' of github.com:CartoDB/Windshaft-cartodb into 691-date-histogram 2017-06-05 16:26:09 +02:00
Daniel García Aubert
1ff0954390 Fix typo 2017-06-05 16:25:47 +02:00
Daniel García Aubert
e82d688a18 Fix typo 2017-06-05 16:09:47 +02:00
Daniel García Aubert
95a6ad3b86 Support quarter aggregation in histograms over date columns 2017-06-05 16:04:42 +02:00
Daniel García Aubert
d01787842f Support UTC timezone override 2017-06-05 15:23:04 +02:00
Daniel García Aubert
c86f92f8eb Improve test description 2017-06-05 15:05:23 +02:00
Daniel García Aubert
003227fb29 Fix assertion 2017-06-05 14:59:35 +02:00
Daniel García Aubert
869408b7b7 Use Eastern Daylight Time while testing 2017-06-05 14:50:49 +02:00
Daniel García Aubert
dc844f8131 Remove console.log 2017-06-05 14:23:53 +02:00
Daniel García Aubert
71e9e62db0 Improved histogram assertion with moment.js 2017-06-05 14:18:24 +02:00
Daniel García Aubert
6ff3b33cde Removed bins_start as query output 2017-06-05 14:17:50 +02:00
Daniel García Aubert
32eeb57fce Reduce complexity in function 2017-06-02 19:00:26 +02:00
Daniel García Aubert
8bc38a375a Support timezone aggregation 2017-06-02 18:37:49 +02:00
Daniel García Aubert
c1fac13d6b Be able to accept timezone parameter 2017-06-02 12:45:34 +02:00
Daniel García Aubert
6374d2e4b6 Fix typo 2017-06-02 12:17:55 +02:00
Daniel García Aubert
9c34428984 Allow override start and end params 2017-06-02 12:15:43 +02:00
Daniel García Aubert
1d66e49910 WIP implemented date histogram 2017-06-01 20:07:46 +02:00
Raul Ochoa
4b562e6768 Merge conditions 2017-05-31 13:00:37 -04:00
Raul Ochoa
b4fbe0b8cf No in advance var definition 2017-05-31 12:58:35 -04:00
Raul Ochoa
62514fc563 Extract query rewrite data to function 2017-05-31 12:58:20 -04:00
Raul Ochoa
ef3cad6599 Extract to function 2017-05-31 12:52:41 -04:00
Raul Ochoa
4e53803b3b Create BBoxFilter independently from rewrite data 2017-05-31 12:51:07 -04:00
Raul Ochoa
40a73f2eaf Merge pull request #695 from CartoDB/fix-bboxes-filters
Add test to detect and fix incorrect bbox filter splitting
2017-05-31 11:23:42 -04:00
Javier Goizueta
31557b06be Add test to detect and fix incorrect bbox filter splitting
When bbox crosses date line and is split in two, the eastern box wasn't correct
2017-05-31 11:09:51 -04:00
Daniel García Aubert
c8ea595f47 Stubs next version 2017-05-31 12:14:58 +02:00
Daniel García Aubert
dbd0398d9b Release 3.9.0 2017-05-31 12:13:25 +02:00
Daniel
4f7ec0dd4d Merge pull request #683 from CartoDB/664-layergroup-stats
Use windshaft-stats to extract info about layer metadata
2017-05-31 11:58:00 +02:00
Daniel García Aubert
5a1623b667 Merge branch 'master' into 664-layergroup-stats 2017-05-31 11:50:32 +02:00
Daniel García Aubert
2c509d97b1 Point windshaft to the last released version 2017-05-31 11:46:46 +02:00
Daniel García Aubert
da3f30dd9f Update NEWS 2017-05-31 11:27:41 +02:00
Mario de Frutos
440953b1cd If we have the stats FF disbabled return empty array instead of null
But we keep checking for elements in the returned object because
we don't want to include the stats property if the FF is disabled
2017-05-30 10:47:47 +02:00
Raul Ochoa
45471597bb Merge pull request #693 from CartoDB/test-improvements
Do not assert inside assert.response
2017-05-26 13:20:44 +02:00
Raul Ochoa
882aeacac2 Rewrite test to take advantage of changes in assert.response/TestClient
This should avoid the issue of preventing the whole suite to halt, as
in https://travis-ci.org/CartoDB/Windshaft-cartodb/builds/236337027.
2017-05-26 13:13:19 +02:00
Raul Ochoa
248adab05b Catch response body if any to capture Redis keys 2017-05-26 13:06:04 +02:00
Raul Ochoa
f4e99629f6 Do not assert inside response, but pass error into callback
Preferably we should put response outside of assert and change its
callback signature. However, I don't think it is worth the effort
right now.
2017-05-26 13:02:02 +02:00
Daniel
df08463dcf Merge pull request #690 from CartoDB/allow-es6-syntax
Allow es6 syntax
2017-05-25 14:28:02 +02:00
Daniel García Aubert
b84bb469e5 Allow es6 syntax 2017-05-25 11:26:04 +02:00
Daniel
26e4d19635 Merge pull request #689 from CartoDB/upgrade-camshaft-to-0.55.2
Upgrade camshaft to 0.55.2
2017-05-24 12:01:39 +02:00
Daniel García Aubert
69984ed895 Upgrade camshaft to 0.55.2 2017-05-24 11:54:30 +02:00
Daniel García Aubert
d471905358 Merge branch 'master' into 664-layergroup-stats 2017-05-23 13:47:27 +02:00
Daniel García Aubert
e5223980cf Update NEWS 2017-05-23 13:46:56 +02:00
Daniel
1f65968de3 Merge pull request #688 from CartoDB/upgrade-camshaft-to-0.55.1
Upgrade camshaft to 0.55.1
2017-05-23 13:45:57 +02:00
Daniel García Aubert
51c11aff03 Upgrade camshaft to 0.55.1 2017-05-23 13:37:34 +02:00
Daniel García Aubert
87e6e64d42 Merge branch 'master' into 664-layergroup-stats 2017-05-23 12:41:14 +02:00
Raul Ochoa
7dfb7c605e Merge pull request #687 from CartoDB/remove-turbo-carto-promise-global
Remove Promise hack from turbo-carto adapter
2017-05-22 18:52:27 +02:00
Raul Ochoa
8b0964ad7e Remove Promise hack from turbo-carto adapter 2017-05-22 18:45:24 +02:00
Daniel García Aubert
5135b6e14a Stubs next version 2017-05-22 14:57:03 +02:00
Daniel García Aubert
dcb26560e3 Release 3.8.0 2017-05-22 14:50:41 +02:00
Daniel
921468668b Merge pull request #686 from CartoDB/upgrade-camshaft-to-0.55.0
Upgrade camshaft to 0.55.0 and turbo-carto to 0.19.1
2017-05-22 14:39:10 +02:00
Mario de Frutos
76c2f8dc0e Includes release changes of turbo-carto too 2017-05-22 14:33:14 +02:00
Daniel García Aubert
7efb196247 Upgrade camshaft to 0.55.0 2017-05-22 13:09:42 +02:00
Raul Ochoa
95c324ddd1 Merge pull request #685 from CartoDB/update-dev-deps
Update dev deps
2017-05-18 18:25:32 +02:00
Raul Ochoa
0a3d1fbdf9 Upgrade jshint and fix test 2017-05-18 17:39:56 +02:00
Raul Ochoa
45c1ccab9e Upgrade mocha dep 2017-05-18 17:39:26 +02:00
Daniel García Aubert
cc2a96579b Merge branch 'master' into 664-layergroup-stats 2017-05-18 16:39:52 +02:00
Daniel García Aubert
61b19856e9 Stubs next version 2017-05-18 16:36:50 +02:00
Daniel García Aubert
67aa2d1a00 Release 3.7.1 2017-05-18 16:34:56 +02:00
Daniel
c6ee2eac62 Merge pull request #684 from CartoDB/fix-buffersize-undefined-in-mapconfig
Fix buffersize undefined in mapconfig instantiation
2017-05-18 16:33:31 +02:00
Daniel García Aubert
3978d58d66 Remove empty line 2017-05-18 16:12:28 +02:00
Daniel García Aubert
cd86387fa7 Merge branch 'fix-buffersize-undefined-in-mapconfig' into 664-layergroup-stats 2017-05-18 15:58:12 +02:00
Daniel García Aubert
3ce38d7081 Going green: fix type error when no buffersize is defined in mapconfig 2017-05-18 15:49:57 +02:00
Daniel García Aubert
e9112da305 Going red: add test to check undefined buffersize in requested mapconfig throws error 2017-05-18 15:41:41 +02:00
Mario de Frutos
c9e6e921cb Merge branch 'master' into 664-layergroup-stats 2017-05-18 13:45:38 +02:00
Daniel García Aubert
4e715f6ba4 Stubs next version 2017-05-18 13:24:48 +02:00
Daniel García Aubert
8f156b9f13 Release 3.7.0 2017-05-18 13:23:22 +02:00
Daniel
954876f738 Merge pull request #673 from CartoDB/665-buffer-size
Manage multiple values of buffer-size for different formats
2017-05-18 13:20:25 +02:00
Daniel García Aubert
fd178bcf71 Upgrade windshaft to 3.2.0 2017-05-18 13:14:51 +02:00
Daniel García Aubert
acaff98da5 Merge branch 'master' into 665-buffer-size 2017-05-18 13:08:46 +02:00
Mario de Frutos
ed56094be2 PR changes 2017-05-18 11:51:12 +02:00
Daniel García Aubert
c65518cf41 Get back layer-stats from windshaft-stats 2017-05-17 20:16:43 +02:00
Daniel García Aubert
fb4ee61b83 Use setInmmediate vs process.nextTick 2017-05-17 12:55:05 +02:00
Daniel García Aubert
808c729a0e Now supported formats for buffer-size customization are bound to the adapter 2017-05-17 12:33:41 +02:00
Daniel García Aubert
4602fb3ecf Send stats for png32 tiles 2017-05-17 12:16:16 +02:00
Daniel García Aubert
c59996303d Send stats for mvt tiles 2017-05-17 12:04:11 +02:00
Daniel García Aubert
13b1978d49 Include layer param to reach the right tile for grid.json 2017-05-17 11:40:53 +02:00
Daniel García Aubert
e13ae8d5af Do not make optional layer param in URL template 2017-05-17 11:40:18 +02:00
Daniel García Aubert
0f16c0e396 Merge branch '664-layergroup-stats' of github.com:CartoDB/Windshaft-cartodb into 664-layergroup-stats 2017-05-16 12:15:40 +02:00
Daniel García Aubert
29361f5392 Use windhshaft with latest changes for layer stats 2017-05-16 12:07:17 +02:00
Mario de Frutos
422867762b package.json for staging 2017-05-12 17:14:07 +02:00
Mario de Frutos
5969c99e8a Removed not used parameters for layer stats 2017-05-12 16:42:10 +02:00
Mario de Frutos
5417933ecc Change to tests for layer stats because now uses CDB_EstimateRowCount fuction 2017-05-12 16:42:10 +02:00
Mario de Frutos
59585b5cd9 We leave only one feature flag for stats 2017-05-12 16:42:10 +02:00
Mario de Frutos
522c86e6f2 Change from branch to commits for staging dependencies 2017-05-12 16:42:04 +02:00
Mario de Frutos
1a7fd9bf31 Changed stats name from featureCount to estimatedFeatureCount 2017-05-12 16:40:34 +02:00
Mario de Frutos
7596df96ed package.json for staging 2017-05-12 12:58:13 +02:00
Mario de Frutos
44cca38538 Change to tests for layer stats because now uses CDB_EstimateRowCount fuction 2017-05-12 12:51:45 +02:00
Mario de Frutos
f6fff6953e We leave only one feature flag for stats 2017-05-12 12:50:57 +02:00
Mario de Frutos
35df0c3a68 Change from branch to commits for staging dependencies 2017-05-11 14:26:00 +02:00
Daniel García Aubert
f9c8178d99 Stubs next version 2017-05-11 13:46:34 +02:00
Daniel García Aubert
787ca1607a Release 3.6.6 2017-05-11 13:37:43 +02:00
Daniel
7179c0a5f1 Merge pull request #682 from CartoDB/camshaft-error-node-id
Upgrade camshaft to 0.54.4
2017-05-11 13:29:29 +02:00
Daniel García Aubert
b739db1023 Use released version of camshaft 2017-05-11 13:19:14 +02:00
Daniel García Aubert
66a898cdc2 Upgrade camshaft to get error node-id 2017-05-11 12:55:53 +02:00
Mario de Frutos
61f9ea6e86 Changed stats name from featureCount to estimatedFeatureCount 2017-05-11 12:47:35 +02:00
Daniel García Aubert
5a44d6c547 Drop geojson support for buffersize customization 2017-05-10 18:35:30 +02:00
Daniel García Aubert
53d1b2fbbf Rename mapconfig-named-map-adapter by mapconfig-buffer-size-adapter 2017-05-10 18:16:22 +02:00
Daniel García Aubert
2c9d30e042 Be more flexible validating buffer-size customization 2017-05-10 17:49:28 +02:00
Mario de Frutos
968677e275 package.json poiting to staging branches 2017-05-10 17:26:12 +02:00
Mario de Frutos
daf19c5e27 Stats backend only provides stats not metadata 2017-05-10 17:17:01 +02:00
Raul Ochoa
ac94118798 Merge pull request #678 from CartoDB/print-attributions
added print attributions from Docs FAQs to Static Maps API content
2017-05-10 09:26:07 +02:00
Mario de Frutos
7d5b6b0820 Lint changes and yarn.lock 2017-05-09 18:24:24 +02:00
Mario de Frutos
b87e442801 Remove vertex count from stats tests 2017-05-09 18:24:11 +02:00
Raul Ochoa
1a197bb9cf Stubs next version 2017-05-09 15:06:49 +02:00
Raul Ochoa
5b96db2ba2 Release 3.6.5 2017-05-09 15:06:00 +02:00
Raul Ochoa
3b687ce09a Merge pull request #681 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.54.3
2017-05-09 15:05:15 +02:00
Raul Ochoa
7bb039b13c Upgrades camshaft to 0.54.3 2017-05-09 14:58:25 +02:00
Mario de Frutos
474d68687c Include vertexCount in the stats tests 2017-05-09 14:47:39 +02:00
Mario de Frutos
b25540720c Added acceptance tests for stats functionallity 2017-05-09 14:36:35 +02:00
Mario de Frutos
759d28f12f Include feature flag to enable/disable stats 2017-05-09 12:51:22 +02:00
Mario de Frutos
15c68711aa Create stats backend to decouple stats logic from map controller 2017-05-09 12:31:16 +02:00
Mario de Frutos
568d6b5458 Include the layers metadata into the layergroup object 2017-05-09 11:59:11 +02:00
Mario de Frutos
525c0f2afa Added rendererCache as dependency for map controller 2017-05-09 11:58:48 +02:00
Mario de Frutos
3f6c8fa51c Use windshaft-stats to get layer stats 2017-05-08 18:42:40 +02:00
Raul Ochoa
0ac53db73a Stubs next version 2017-05-05 16:04:25 +02:00
Raul Ochoa
36e9239056 Release 3.6.4 2017-05-05 16:03:53 +02:00
Raul Ochoa
4e6e267f10 Fix news 2017-05-05 16:03:38 +02:00
Raul Ochoa
2c235b6629 Merge pull request #680 from CartoDB/upgrade-deps
Upgrade deps
2017-05-05 16:02:24 +02:00
Raul Ochoa
6bd7537467 Upgrade deps 2017-05-05 15:57:02 +02:00
Daniel García Aubert
55a351d751 Point windshaft to a specific buffer-size commit 2017-05-03 17:35:55 +02:00
Daniel García Aubert
05d3b3bf66 Point windshaft to specific commit for buffer-size configuration 2017-05-03 17:21:08 +02:00
Daniel García Aubert
e97466378e Add test for different formats to anonymous maps and named maps with placeholders 2017-05-03 11:17:51 +02:00
csobier
8426dd00f1 added print attributions from Docs FAQs to Static Maps API content 2017-05-02 12:48:55 -04:00
Daniel García Aubert
b2b6cf1f02 Merge branch '665-buffer-size' of github.com:CartoDB/Windshaft-cartodb into 665-buffer-size 2017-04-28 19:23:49 +02:00
Daniel García Aubert
c9af38ecd0 Fix issue when 'grid.json' format is not captured properly due to a weird behaviour in regex 2017-04-28 19:21:51 +02:00
Mario de Frutos
be58adb1b9 Be able to override buffer-size configuration without placeholders in named maps 2017-04-28 19:20:00 +02:00
Mario de Frutos
bfb283c5ba wip 2017-04-28 14:46:36 +02:00
Mario de Frutos
332a56b736 Mapconfig only support object for the buffer-size property 2017-04-28 14:22:16 +02:00
Daniel García Aubert
2f4e4246a4 Refactor test-client in order to use same interface for named and anonymous maps 2017-04-26 18:27:18 +02:00
Daniel García Aubert
c481d6473c Use parseInt instead of number constructor 2017-04-26 17:01:21 +02:00
Daniel García Aubert
40c0e306af Remove invalid assertions 2017-04-25 20:40:17 +02:00
Daniel García Aubert
0d840e6daf Javascript style typo 2017-04-25 19:41:30 +02:00
Daniel García Aubert
07e507e1aa Remove dictionary as placeholder type for named maps 2017-04-25 19:40:12 +02:00
Mario de Frutos
7ea7a991aa Buffersize customizable through named maps' placeholders 2017-04-25 19:27:31 +02:00
Daniel García Aubert
0577fa5308 Add test 2017-04-25 17:54:31 +02:00
Daniel García Aubert
f29ee1b4ac Add test to use placeholder buffer-size value 2017-04-25 15:48:23 +02:00
Daniel García Aubert
0c08713521 First attempt: support buffer-size configuration for named maps 2017-04-25 14:34:17 +02:00
Raul Ochoa
567928a7f5 Stubs next version 2017-04-25 12:36:29 +02:00
Raul Ochoa
ae9e211f30 Release 3.6.3 2017-04-25 12:35:34 +02:00
Raul Ochoa
b5b75df91a Merge pull request #674 from CartoDB/upgrade-windshaft
Upgrades windshaft to 3.1.1
2017-04-25 12:33:22 +02:00
Raul Ochoa
8ddccc0b0c Upgrades windshaft to 3.1.1 2017-04-25 12:19:49 +02:00
Daniel García Aubert
383a1a330a Test with buffer-size 0 2017-04-25 10:43:07 +02:00
Raul Ochoa
95195fff6f Stubs next version 2017-04-24 19:33:03 +02:00
Raul Ochoa
93b77dc4c1 Release 3.6.2 2017-04-24 19:32:10 +02:00
Raul Ochoa
4aee7fb1b8 Merge pull request #671 from CartoDB/upgrade-deps
Upgrades grainstore to 1.6.3
2017-04-24 19:31:20 +02:00
Raul Ochoa
a6d68dba5e Upgrades grainstore to 1.6.3 2017-04-24 19:11:53 +02:00
Daniel García Aubert
109c550187 Remove filter 2017-04-24 18:57:20 +02:00
Daniel García Aubert
06353941e6 Implement test to exercise buffer-size configuration by format 2017-04-24 18:56:15 +02:00
Daniel García Aubert
fed953d195 Support mvt tiles 2017-04-24 18:55:08 +02:00
Raul Ochoa
883f87c7c8 Document gc_interval configuration entry 2017-04-24 18:28:51 +02:00
Raul Ochoa
14d37268d6 Stubs next version 2017-04-24 14:44:38 +02:00
Raul Ochoa
4b6181039d Release 3.6.1 2017-04-24 14:43:46 +02:00
Raul Ochoa
47944671c6 fix release date 2017-04-24 14:43:23 +02:00
Raul Ochoa
f33a7dd665 Merge pull request #668 from CartoDB/upgrade-camshaft
Upgrade camshaft to 0.54.1
2017-04-24 14:41:06 +02:00
Raul Ochoa
781e5a71bf Upgrade camshaft to 0.54.1 2017-04-24 12:29:08 +02:00
Raul Ochoa
c4ff884ad0 Merge pull request #666 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.54.0
2017-04-20 18:33:07 +02:00
Raul Ochoa
02b9f85b16 Upgrades camshaft to 0.54.0 2017-04-20 18:25:57 +02:00
Daniel García Aubert
2756252368 Stubs next version 2017-04-11 19:23:04 +02:00
Daniel García Aubert
a386abf5a5 Release 3.5.1 2017-04-11 18:34:18 +02:00
Daniel
e5c2c35a81 Merge pull request #662 from CartoDB/upgrade-camshaft-to-0.53.1
Upgrade camshaft to 0.53.1
2017-04-11 18:31:49 +02:00
Daniel García Aubert
227112c7aa Update yarn.lock 2017-04-11 18:27:54 +02:00
Daniel García Aubert
a4ed37bdfc Upgrade camshaft to 0.53.1 2017-04-11 18:19:39 +02:00
Daniel García Aubert
c6a62cee61 Stubs next version 2017-04-10 16:13:30 +02:00
Daniel García Aubert
891bc818b2 Release 3.5.0 2017-04-10 12:20:44 +02:00
Daniel
ebe25d6f20 Merge pull request #638 from CartoDB/629_fix_cache_invalidation
Fix cache invalidation problem with affected tables
2017-04-10 11:55:57 +02:00
Daniel García Aubert
92ec17218b Upgrade camshaft to 0.53.0 2017-04-10 11:36:17 +02:00
Mario de Frutos
e8a0f6b7b6 Point to camshaft branch to test properly 2017-04-07 16:00:29 +02:00
Mario de Frutos
125c39967c Make the cache headers tests idempotent 2017-04-07 15:59:58 +02:00
Mario de Frutos
4132bc755d Add cdb_invalidate_varnish function fixture to tests 2017-04-07 15:59:58 +02:00
Mario de Frutos
9707881bf9 Include check for surrogate-key header and renamed the test file 2017-04-07 15:59:58 +02:00
Mario de Frutos
fa6493ae44 Affected tables are now included in X-Cache-Channel 2017-04-07 15:59:58 +02:00
Mario de Frutos
0c387cf6d9 Add more tests for x-cache-channel but with analysis 2017-04-07 15:59:58 +02:00
Mario de Frutos
5e4d1d5c1c Get affected tables and add it to the layergroup 2017-04-07 15:59:58 +02:00
Raul Ochoa
4d82fd65f6 Merge pull request #659 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.52.0
2017-04-07 14:41:14 +02:00
Raul Ochoa
6d3644f13b Upgrades camshaft to 0.52.0 2017-04-07 13:29:30 +02:00
Raul Ochoa
7a5aa7ba35 Stubs next version 2017-04-03 16:22:15 +02:00
Raul Ochoa
9c9609eb2b Release 3.4.0 2017-04-03 16:21:29 +02:00
Raul Ochoa
418d3c074f Merge pull request #657 from CartoDB/upgrade-camshaft
Upgrade camshaft to 0.51.0
2017-04-03 16:15:48 +02:00
Raul Ochoa
6bbda3d41e Upgrade camshaft to 0.51.0 2017-04-03 15:53:39 +02:00
Raul Ochoa
25669bb3f2 Stubs next version 2017-04-03 13:07:53 +02:00
Raul Ochoa
508d495a23 Release 3.3.0 2017-04-03 13:07:05 +02:00
Raul Ochoa
06427dc009 Bump version and add news 2017-04-03 13:06:37 +02:00
Raul Ochoa
c325df1414 Merge pull request #655 from CartoDB/static-maps-layers-filter
Static maps layers filter
2017-04-03 12:07:38 +02:00
Raul Ochoa
07447160e3 Merge pull request #654 from CartoDB/non-conditional-profiler
Remove all conditional branches to call req.profiler
2017-04-03 11:58:38 +02:00
Raul Ochoa
ededc73fd7 Throw on invalid params argument 2017-03-31 18:39:29 +02:00
Raul Ochoa
cad02bfad7 Remove all conditional branches to call req.profiler
req.profiler is created in a middleware for all requests.
2017-03-30 20:31:53 +02:00
Raul Ochoa
94299f0452 Configure extra allowed params per endpoint via middleware
Instead of making all params available in all endpoints, we control
what endpoints allow what extra params.

Dataviews endpoints should be migrated to this.
2017-03-30 20:12:55 +02:00
Raul Ochoa
ae5d82c41d Add test to go red 2017-03-30 20:12:20 +02:00
Raul Ochoa
6468822295 Remove layer param before creating a better solution 2017-03-30 20:08:45 +02:00
Raul Ochoa
777ae31426 Merge branch 'master' into static-maps-layers-filter 2017-03-30 19:33:59 +02:00
Raul Ochoa
1ca56fb81c Update news 2017-03-30 17:52:25 +02:00
Raul Ochoa
5d74e1eafe Stubs next version 2017-03-30 14:33:41 +02:00
Raul Ochoa
f3fdd7ff25 Release 3.2.0 2017-03-30 14:32:48 +02:00
Raul Ochoa
fbbe69dac0 Merge pull request #652 from CartoDB/upgrade-windshaft
Update windshaft to 3.1.0
2017-03-30 14:32:21 +02:00
Raul Ochoa
ac54179f14 Update windshaft to 3.1.0 2017-03-30 14:12:31 +02:00
Raul Ochoa
50d296e46c Merge pull request #650 from CartoDB/upgrade-grainstore-1.6.2
Upgrade dependencies: grainstore@1.6.2
2017-03-29 16:16:50 +02:00
Raul Ochoa
616ba6500c Merge pull request #649 from CartoDB/gc
Active GC interval
2017-03-29 16:11:48 +02:00
Daniel García Aubert
d9968f2c91 Upgrade dependencies: grainstore@1.6.2 2017-03-29 16:02:37 +02:00
Raul Ochoa
8ca9c5bcf7 Active GC interval
Interval timer is configurable, disabling by using <=0 value.
2017-03-29 15:56:30 +02:00
Daniel García Aubert
6a4b412cd3 Avoid lint 2017-03-27 18:27:55 +02:00
Daniel García Aubert
2374711d63 Remove reference to issue 2017-03-24 17:34:05 +01:00
Daniel García Aubert
213a3e297c Check node version 2017-03-24 17:28:23 +01:00
csobier
a7b0618f91 Merge pull request #643 from CartoDB/docs-fix-broken-hyperlinks
fixed docs example links, Andy changed his user name so links broke. …
2017-03-24 09:44:50 -04:00
csobier
e9896e34e1 found and fixed a typo 2017-03-24 09:33:15 -04:00
csobier
28bd03765a fixed docs example links, Andy changed his user name so links broke. I fixed. 2017-03-24 09:04:31 -04:00
Daniel García Aubert
24a86ae8df Stubs next version 2017-03-23 11:04:12 +01:00
Daniel García Aubert
f5c349e105 Release 3.1.1 2017-03-23 11:02:04 +01:00
Raul Ochoa
e8d2e28dba Merge pull request #642 from CartoDB/resources-urls-crc-hash
Use crc32 instead of md5 for computing subdomain candidate
2017-03-23 01:21:50 +01:00
Raul Ochoa
e0c2423ace Remove unused import 2017-03-23 01:14:56 +01:00
Raul Ochoa
5e429ba71f Use crc32 instead of md5 for computing subdomain candidate 2017-03-23 01:03:45 +01:00
Daniel García Aubert
64dfdba94d Release 3.1.0 2017-03-22 19:20:24 +01:00
Daniel
3866413504 Merge pull request #641 from CartoDB/resource-urls
Generate URLs for resources based on CDN + template rules
2017-03-22 19:15:08 +01:00
Raul Ochoa
2da834784f Generate URLs for resources based on CDN + template rules 2017-03-22 18:58:37 +01:00
Daniel García Aubert
d6181da32b Stubs next version 2017-03-22 13:53:48 +01:00
Daniel García Aubert
8287b94a25 Release 3.0.2 2017-03-22 13:20:59 +01:00
Daniel García Aubert
bc633301fe Update HOWTO_RELEASE 2017-03-22 13:11:12 +01:00
Daniel García Aubert
ed94fb4a66 Define yarn version of clients that must be used 2017-03-22 13:10:06 +01:00
Daniel García Aubert
fc27086052 Remove script to generate shrinkwrap 2017-03-22 13:08:12 +01:00
Daniel García Aubert
de1d1961e3 Upgrade yarn.lock depdendencies: depth > 1 2017-03-22 12:55:22 +01:00
Daniel García Aubert
a90a9383b4 Stubs next version 2017-03-21 19:45:25 +01:00
Daniel García Aubert
fd244287d5 Release 3.0.1 2017-03-21 19:43:46 +01:00
Daniel
fafe9e7e8a Merge pull request #640 from CartoDB/upgrade-windshaft-3.0.1
Bump windshaft version to 3.0.1
2017-03-21 19:35:54 +01:00
Daniel García Aubert
db37513206 Bump windshaft version to 3.0.1 2017-03-21 19:15:41 +01:00
Daniel García Aubert
c023088a3f Stubs next version 2017-03-21 15:44:33 +01:00
Daniel García Aubert
59f6217c4f Release 3.0.0 2017-03-21 15:34:47 +01:00
Daniel
0e43fbbb34 Merge pull request #635 from CartoDB/node-v6
Support Node v6 LTS and upgrade to Mapnik v3.x
2017-03-21 15:30:59 +01:00
Daniel García Aubert
1720f22247 Improve doc: 'yarn install' command is deprecated, use 'yarn' instead 2017-03-21 14:58:09 +01:00
Daniel García Aubert
3f791d25b5 Add a note about moving from npm to yarn 2017-03-17 17:58:33 +01:00
Daniel García Aubert
acd3047500 Update NEWS 2017-03-17 17:49:19 +01:00
Daniel García Aubert
7b3a4aa2a8 Update README.md 2017-03-17 17:41:20 +01:00
Daniel García Aubert
4bfaeeb44b Update INSTALL.md 2017-03-17 17:37:35 +01:00
Daniel García Aubert
a094ae7197 Update NEWS 2017-03-17 17:30:58 +01:00
Daniel García Aubert
ef0362d118 Fix windshaft version to 3.0.0 to avoid warning message while starting the service 2017-03-17 17:21:09 +01:00
Daniel García Aubert
5a5763684d Don't provide a npm's shrinkwrap anymore 2017-03-17 17:17:17 +01:00
Daniel García Aubert
6e575300e3 Update yarn.lock 2017-03-17 17:13:49 +01:00
Daniel García Aubert
8109fc4d46 Merge branch 'master' into node-v6 2017-03-17 17:06:58 +01:00
Daniel García Aubert
e0519e7851 Stubs next version 2017-03-17 17:06:39 +01:00
Daniel García Aubert
6334df5f5f Merge branch 'master' into node-v6 2017-03-17 17:03:53 +01:00
Daniel García Aubert
38294d29f5 Release 2.89.0 2017-03-17 16:45:18 +01:00
Daniel
5b131cc8a7 Merge pull request #639 from CartoDB/upgrade-windshaft-to-2.8.0
Upgrade windshaft to 2.8.0
2017-03-17 16:37:07 +01:00
Daniel García Aubert
5dee654132 Upgrade windshaft to 2.8.0 2017-03-17 16:26:26 +01:00
Daniel García Aubert
d902476780 Fix assertions, now MapCofig.getLayer() return {} if layer not found 2017-03-17 11:06:40 +00:00
Ubuntu
bc5dabef3c Revert "Fix assertions, now MapCofig.getLayer() return {} if layer not found"
This reverts commit c839a0b0a3.
2017-03-17 11:04:50 +00:00
Daniel García Aubert
024f1e4851 Fix assertions, now MapCofig.getLayer() return {} if layer not found 2017-03-17 10:45:59 +00:00
Raul Ochoa
5f87417d9e Merge pull request #637 from CartoDB/histogram-type-discovery
Histogram column type discovery query uses non-filtered query
2017-03-17 11:03:15 +01:00
Raul Ochoa
fa94550261 Include changes for overviews implementation 2017-03-16 19:15:34 +01:00
Daniel García Aubert
11efbf034e Drop support for Node 0.10 2017-03-16 17:18:44 +01:00
Daniel García Aubert
c839a0b0a3 Fix assertions, now MapCofig.getLayer() return {} if layer not found 2017-03-16 16:44:41 +01:00
Daniel García Aubert
420b657db8 Upgrade windshaft to 3.0.0 2017-03-16 16:42:43 +01:00
Raul Ochoa
2656a26272 Merge pull request #622 from strk/typo
Trip epoch is over...
2017-03-16 16:26:53 +01:00
Raul Ochoa
8694c120bc Allow to overwrite layers filter in static maps images 2017-03-15 11:00:10 +01:00
Raul Ochoa
992b2b6ba7 Histogram column type discovery query uses non-filtered query
Pass all queries to the dataview and use the no filters one for
discovering what is the column type associated to the histogram dataview.
2017-03-13 18:40:29 +01:00
Raul Ochoa
924f009390 Test for #606: function avg(timestamp with time zone) does not exist 2017-03-13 18:36:43 +01:00
Raul Ochoa
48a1244fa0 Stubs next version 2017-03-10 11:06:47 +01:00
Raul Ochoa
8789a959e5 Release 2.88.4 2017-03-10 11:06:06 +01:00
Raul Ochoa
5765ac59cc Merge pull request #636 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.50.3
2017-03-10 11:05:30 +01:00
Raul Ochoa
3b9bf96431 Upgrades camshaft to 0.50.3 2017-03-10 10:58:07 +01:00
Daniel García Aubert
a5fe5e7052 Update shrinkwrap 2017-03-08 10:56:01 +01:00
Daniel García Aubert
0f96b5a4a5 Update yarn.lock 2017-03-08 10:24:04 +01:00
Daniel García Aubert
25babeae56 Merge branch 'node-v6-yarn' into node-v6 2017-03-07 18:01:16 +01:00
Raul Ochoa
1951e79962 Make assertions compatible 2017-03-07 13:27:13 +01:00
Daniel García Aubert
1e0e31cc1c Merge branch 'node-v6' of github.com:CartoDB/Windshaft-cartodb into node-v6 2017-03-07 13:02:18 +01:00
Daniel García Aubert
8d35f72fcb Back to use current assertions as grainstore implements a fallback mechanism when translates styles 2017-03-07 12:59:52 +01:00
Daniel García Aubert
5f3e515131 Back test to use '=~' operator which is now supported by carto@0.15.1-cdb-3 in windshaft 2017-03-07 12:58:06 +01:00
Raul Ochoa
49236fce86 Upgrade locked deps 2017-03-02 11:38:09 +01:00
Raul Ochoa
9d2dde7a5a Merge branch 'node-v6' into node-v6-yarn 2017-03-02 11:07:52 +01:00
Raul Ochoa
c3e703237c Merge remote-tracking branch 'origin/master' into node-v6 2017-03-02 11:07:43 +01:00
Mario de Frutos
8868066445 Stubs next version 2017-03-02 11:00:53 +01:00
Mario de Frutos
b446c31cbc Other category now uses the selected aggregated function (#633)
* Other category in category widget uses selected aggregation function
Fixes https://github.com/CartoDB/Windshaft-cartodb/issues/628
2017-03-02 10:48:20 +01:00
Raul Ochoa
2d6e7070a6 Stubs next version 2017-02-23 18:12:54 +01:00
Raul Ochoa
473e0cb902 Release 2.88.2 2017-02-23 18:12:14 +01:00
Raul Ochoa
1a8fca0534 Formatting 2017-02-23 18:11:39 +01:00
Raul Ochoa
e24bc12fc9 Merge pull request #632 from CartoDB/upgrade-camshaft
Upgrades camshaft to 0.50.2
2017-02-23 18:10:22 +01:00
Raul Ochoa
e77c9141ed Upgrades camshaft to 0.50.2 2017-02-23 18:00:55 +01:00
Raul Ochoa
321157b17b Make target to generate shrinkwrap file applying prune
It removes dev dependencies from the local node_modules
and avoid getting those into shrinkwrap file.
2017-02-23 17:57:52 +01:00
Raul Ochoa
6ac6574b4c clean target to completely delete node_modules dir 2017-02-23 17:57:44 +01:00
Raul Ochoa
70ff0a9b8f Update freezed deps 2017-02-22 19:17:00 +01:00
Raul Ochoa
15bdb57a22 Merge remote-tracking branch 'origin/node-v6' into node-v6-yarn 2017-02-22 19:02:55 +01:00
Raul Ochoa
bb54e5520c Merge remote-tracking branch 'origin/master' into node-v6 2017-02-22 19:02:27 +01:00
Raul Ochoa
933d486a57 Merge pull request #630 from CartoDB/close-response-timer
Close timer for response preparation
2017-02-22 18:46:56 +01:00
Raul Ochoa
8a1c7f5b52 Close timer for response preparation
Timer for affectedTables is taking everything from response timing,
adding a tag to represent all the response preparation.
That way affectedTables only represents the time for retrieving the
affected tables themselves.
2017-02-22 18:38:25 +01:00
Rafa de la Torre
822954be5d Stub next version 2017-02-21 11:06:54 +01:00
Rafa de la Torre
57dc17518c Release 2.88.1 2017-02-21 11:01:15 +01:00
Mario de Frutos
3df8d4844e Stubs next version 2017-02-21 08:17:09 +01:00
Mario de Frutos
5a0443618f Merge pull request #626 from CartoDB/camshaft_v050
Camshaft 0.50.0
2017-02-21 08:08:34 +01:00
Raul Ochoa
8a76cd506f Fix issue with global Promise object 2017-02-20 18:46:48 +01:00
Mario de Frutos
50d05eae47 Version 2.88.0
Update camshaft version to 0.50.0
2017-02-20 18:46:47 +01:00
Raul Ochoa
ca41b3b600 Merge pull request #627 from CartoDB/change_release
We don't announce release deploy in google groups anymore
2017-02-20 10:31:39 +01:00
Mario de Frutos
43a17ddc7d We don't announce release deploy in google groups anymore 2017-02-17 18:01:59 +01:00
Mario de Frutos
dfa347f860 Update camshaft dependency to 0.50 2017-02-17 16:29:34 +01:00
Raul Ochoa
6033027812 Merge branch 'node-v6-shrinkwrap' into node-v6-yarn 2017-02-17 13:42:32 +01:00
Raul Ochoa
9ee6f7fbb8 Regenerate npm-shrinkwrap.json with npm@2.x 2017-02-17 13:41:58 +01:00
Raul Ochoa
60c0754800 Make assertions compatible 2017-02-17 13:36:15 +01:00
Raul Ochoa
a9251c5e71 Fix issue with global Promise object 2017-02-17 13:35:41 +01:00
Raul Ochoa
7daeddc946 Use yarn 2017-02-17 11:27:01 +01:00
Raul Ochoa
dbdb00070e Remove artificial node-zipfile dep 2017-02-17 11:26:46 +01:00
Raul Ochoa
e5c3c282ef Log Node.js version on startup 2017-02-10 10:03:06 +01:00
Raul Ochoa
caba79b5e2 Make target to generate shrinkwrap file applying prune
It removes dev dependencies from the local node_modules
and avoid getting those into shrinkwrap file.
2017-02-07 20:03:47 +01:00
Raul Ochoa
d359ea7fa6 clean target to completely delete node_modules dir 2017-02-07 19:55:37 +01:00
Raul Ochoa
c0abbe570f Add npm-shrinkwrap.json file 2017-02-07 18:56:45 +01:00
Raul Ochoa
229a2c0c3c Remove npm-shrinkwrap.json until we solve the issue associated to it 2017-02-07 18:50:57 +01:00
Daniel García Aubert
3f185c9c69 revert: disable cache for ci builds 2017-02-07 15:28:21 +01:00
Daniel García Aubert
f86f72ab27 disable cache for ci builds 2017-02-07 15:19:05 +01:00
Daniel García Aubert
74af17cc65 Add ubuntu toolchain for builds 2017-02-07 12:12:17 +01:00
Daniel García Aubert
aaa3e34c7f Use gcc 4.9 for build in travis 2017-02-07 11:55:21 +01:00
Daniel García Aubert
a053f198f5 Generate shrinkwrap 2017-02-07 11:45:48 +01:00
Daniel García Aubert
852ba68895 Upgrade redis in dev-dependency 2017-02-07 11:44:53 +01:00
Daniel García Aubert
1b22d176d6 Merge branch 'master' into node-v6 2017-02-06 19:03:16 +01:00
Daniel García Aubert
0ccbedf551 Use updated branch of windshaft 2017-02-06 18:25:32 +01:00
Raul Ochoa
28f1179336 Stubs next version 2017-02-02 16:44:41 +01:00
Raul Ochoa
de4d9e285e Release 2.87.5 2017-02-02 16:43:43 +01:00
Raul Ochoa
e0faaac822 Update news 2017-02-02 16:43:04 +01:00
Raul Ochoa
c84f27dd3f Merge pull request #623 from CartoDB/fix-dataviews-override-params-casting
Cast all dataview overrides values to Number
2017-02-02 16:42:48 +01:00
Raul Ochoa
12279d5c00 Cast dataview override values to Number or throw error
We were letting params expected as Numbers to be passed as any type
when they were not Numbers.
2017-02-02 16:20:16 +01:00
Raul Ochoa
281588abd2 Add test to validate bins param is casted as Number 2017-02-02 16:12:49 +01:00
Sandro Santilli
7e206b84aa Fix typo 2017-01-31 13:16:36 +01:00
Mario de Frutos
f69f999694 Fixed contributing link 2017-01-25 10:43:24 +01:00
Daniel García Aubert
c0c062592f Stubs next version 2017-01-20 11:40:00 +01:00
Daniel García Aubert
06885e2ba3 Release 2.87.4 2017-01-20 11:32:11 +01:00
Daniel
89a268d087 Merge pull request #617 from CartoDB/497-null-category
Be able to not compute NULL categories and null values
2017-01-20 11:26:12 +01:00
Daniel García Aubert
34424e713c Test on Node v6 2017-01-19 12:42:53 +01:00
Daniel García Aubert
89f381439f Pass test 2017-01-19 12:24:04 +01:00
Daniel García Aubert
6a80be9df3 Update windshaft dependency 2017-01-19 12:23:43 +01:00
Daniel García Aubert
fde1923acb Removed invalid selector 2017-01-19 11:31:55 +01:00
Daniel García Aubert
d486e1d34f Use released version of camshaft that supports node v6 2017-01-18 14:43:02 +01:00
csobier
3648b8b0b1 removed "default" from descriptions
As per a customer Support inquiry, I removed "default" from the Static Maps Limits section, as it was confusing to the user that it implied
2017-01-17 11:21:23 -05:00
Daniel García Aubert
83301238d2 Port changes to overviews 2017-01-17 17:10:08 +01:00
Daniel García Aubert
a4a1fb930a Be able to not compute NULL categories and null values wheter aggregation operation is not 'count' 2017-01-17 17:09:17 +01:00
Daniel García Aubert
6555353e0e Improve test to handle NULL values in category and aggregation columns using any operation 2017-01-16 19:23:08 +01:00
Daniel García Aubert
f5f0601e53 Add test to check if NULL category count values properly 2017-01-16 17:00:28 +01:00
Raul Ochoa
2598595e42 Merge pull request #614 from CartoDB/zipfile-cartodb
Use zipfile from cartodb
2016-12-23 14:47:40 +01:00
Raul Ochoa
49b78a85c9 Use zipfile from cartodb
Adding it as dependency in combination with loose definition in
millstone makes it to use the top level defined dependency.
2016-12-22 19:12:30 +01:00
Daniel García Aubert
35b12ebd6c Test unused directive just for mapnik 2.3.x 2016-12-19 17:29:24 +01:00
Javier Goizueta
0918c8e68c Stub next version 2016-12-19 17:20:18 +01:00
Javier Goizueta
1603a07de1 Release 2.87.3 2016-12-19 17:13:12 +01:00
Javier Goizueta
0a37aa4ba1 Merge pull request #604 from CartoDB/fix-overviews-dataviews
Fixes for dataviews using overviews
2016-12-19 16:55:13 +01:00
Javier Goizueta
b721a80fcc Merge branch 'master' into fix-overviews-dataviews 2016-12-19 16:45:28 +01:00
Rafa de la Torre
01365d035e Stub version 2.87.3 2016-12-19 16:38:27 +01:00
Rafa de la Torre
a4f059e20f Merge pull request #605 from CartoDB/update-camshaft-0.48.5
Update camshaft to 0.48.5
2016-12-19 16:33:27 +01:00
Daniel García Aubert
eb758bbf36 Use a valid port from env 2016-12-19 16:19:41 +01:00
Daniel García Aubert
bc2441e66a Use a valid port 2016-12-19 16:17:41 +01:00
Daniel García Aubert
7c1792bbd2 Test regression and unused directives only for mapnik ~2.3.x 2016-12-19 16:16:50 +01:00
Daniel García Aubert
2fdbc3e61c Fix error message in assertion 2016-12-19 16:15:07 +01:00
Daniel García Aubert
2ace705122 Fix error message in assertion 2016-12-19 16:13:55 +01:00
Daniel García Aubert
4b817062d8 Bump version of dependencies to be Node v6 compatible 2016-12-19 16:12:57 +01:00
Rafa de la Torre
79c35118d7 Update camshaft to 0.48.5
Use exception safe Dataservices API functions. See
https://github.com/CartoDB/dataservices-api/issues/314 and
https://github.com/CartoDB/camshaft/issues/242
2016-12-19 15:52:25 +01:00
Javier Goizueta
6a4f5d52ec Don't use overviews for date histograms 2016-12-16 17:51:36 +01:00
Javier Goizueta
ccaae2dd66 Remove spurious parameter from overviews dataviews functions
In the overviews-specialized dataview classes the sql-generating
functions had an unneeded parameter filters.
In some cases, since this parameter was not being paaased from
the base dataviews class it was masking the override parameter.
2016-12-16 17:37:05 +01:00
Raul Ochoa
d335e64f88 Stubs next version 2016-12-13 14:16:49 +01:00
Raul Ochoa
177d7ed07a Release 2.87.1 2016-12-13 14:15:50 +01:00
Raul Ochoa
85a1e15b58 Merge pull request #603 from CartoDB/upgrade-deps
Upgrade windshaft and request deps
2016-12-13 14:15:04 +01:00
Raul Ochoa
432b58a078 Upgrade windshaft and request deps 2016-12-13 14:10:42 +01:00
xavijam
75e3c5daef Ready for next release 2016-12-13 10:43:16 +01:00
Raul Ochoa
deb71c27b0 Merge pull request #601 from CartoDB/update-turbocarto
Update turbocarto package version
2016-12-12 18:56:54 +01:00
Raul Ochoa
8f5e1de6d8 Merge branch 'master' into update-turbocarto 2016-12-12 18:51:04 +01:00
Raul Ochoa
4836d62d7a Merge pull request #602 from CartoDB/travis-improvements
Travis improvements
2016-12-12 18:50:39 +01:00
Raul Ochoa
d27b0617b2 Remove comments 2016-12-12 18:44:25 +01:00
Raul Ochoa
28a2c29a39 Attempt to use postgis 2.3 2016-12-12 18:39:57 +01:00
Raul Ochoa
fcb6478407 Attempt to use postgis 2.2 2016-12-12 18:33:19 +01:00
Raul Ochoa
6d72afe40e Test sudoless travis 2016-12-12 17:30:14 +01:00
Raul Ochoa
e775266c64 Remove notifications 2016-12-12 17:29:32 +01:00
xavijam
12f25b38c0 Updated news 2016-12-12 17:03:56 +01:00
xavijam
c67a1107cb Package version updated with turbo-carto cahnges 2016-12-12 17:02:31 +01:00
xavijam
34bfb0d62c Updated news 2016-12-12 17:02:15 +01:00
Javier Goizueta
ede45cad1f Stub next version 2016-12-02 15:25:52 +01:00
Javier Goizueta
75fe4c8aed Release 2.86.1 2016-12-02 15:19:29 +01:00
Javier Goizueta
12e272a7e5 Merge pull request #599 from CartoDB/597-overviews-sql_wrap
Queries with sql_wrap should not be rewritten
2016-12-02 15:07:59 +01:00
Javier Goizueta
cfcba4e578 Wueries with sql_wrap should not be rewritten 2016-12-02 14:00:21 +01:00
Raul Ochoa
37ab898426 Stubs next version 2016-12-02 10:43:00 +01:00
Raul Ochoa
68865ea929 Release 2.86.0 2016-12-02 10:41:23 +01:00
Raul Ochoa
86674faa22 Update news and bump version 2016-12-02 10:41:02 +01:00
Raul Ochoa
f07947ce45 Merge pull request #597 from CartoDB/upgrade-windshaft
Upgrade windshaft
2016-12-02 10:32:44 +01:00
Raul Ochoa
6a50f59e25 Regenerate npm-shrinkwrap.json 2016-12-01 17:13:32 +01:00
Raul Ochoa
bfacd56800 Allow to use workers for transforming cartocss into mapnik XML 2016-12-01 17:02:40 +01:00
Raul Ochoa
45dea8b0c1 Stubs next version 2016-11-30 11:09:18 +01:00
Raul Ochoa
2f7f8cf2d8 Release 2.85.1 2016-11-30 11:07:29 +01:00
Raul Ochoa
31611b6a28 Upgrades camshaft to 0.48.4 2016-11-30 10:59:44 +01:00
Raul Ochoa
d1cd4b0c2b Stubs next version 2016-11-24 16:15:47 +01:00
Raul Ochoa
c8ba1c3e7c Release 2.85.0 2016-11-24 16:14:48 +01:00
Raul Ochoa
fbc8fe4c2d Update news and bump version 2016-11-24 16:11:08 +01:00
Raul Ochoa
54ec9b48db Ignore vscode settings dir 2016-11-24 15:41:09 +01:00
Raul Ochoa
488698d5e2 Merge pull request #594 from CartoDB/resources-url-templates
Allow to set resource URL templates with substitution tokens
2016-11-24 15:37:23 +01:00
Raul Ochoa
58c407aabb Alternative development example configuration for user in path instead of host 2016-11-24 12:57:45 +01:00
Raul Ochoa
fe750f23bc Closer to reality production example configuration 2016-11-24 12:56:38 +01:00
Raul Ochoa
87a01a5cfd Example configuration with just HTTP 2016-11-24 12:56:02 +01:00
Javier Goizueta
74dd669bb0 Stub next version 2016-11-23 15:29:50 +01:00
Javier Goizueta
36a50389f5 Release 2.84.2 2016-11-23 15:09:24 +01:00
Javier Goizueta
4f2d7434c7 Merge pull request #596 from CartoDB/upgrade-camshaft-to-0.48.3
Upgrade Camshaft version to 0.48.3
2016-11-23 15:05:43 +01:00
Javier Goizueta
b0a0848476 Upgrade Camshaft version to 0.48.3 2016-11-23 13:17:16 +01:00
Javier Goizueta
9fcd897e54 Stub next version 2016-11-23 11:57:05 +01:00
Javier Goizueta
daa8fff21e Release 2.84.1 2016-11-23 11:53:37 +01:00
Javier Goizueta
785229ddea Merge pull request #595 from CartoDB/upgrade-camshaft-to-0.48.2
Upgrade camshaft version to 0.48.2
2016-11-23 11:50:45 +01:00
Javier Goizueta
8bb11bf1d4 Upgrade camshaft version to 0.48.2 2016-11-23 11:36:38 +01:00
Raul Ochoa
1f975e15c1 Default to empty object for cdn URLs 2016-11-22 17:01:34 +01:00
Raul Ochoa
6c69ba54db Use actual CDN url for HTTP and HTTPS 2016-11-22 16:44:06 +01:00
Raul Ochoa
49f9904d00 Allow to set resource URL templates with substitution tokens 2016-11-22 16:41:31 +01:00
Raul Ochoa
7afd0dfa4e Remove prototype reference 2016-11-22 13:38:56 +01:00
Raul Ochoa
b1b6a437a7 Merge pull request #593 from CartoDB/592-doc-preview-layers
Fix DOC for named map  and preview layers
2016-11-22 12:52:24 +01:00
Daniel García Aubert
e4d5006591 Merge branch 'master' into 592-doc-preview-layers 2016-11-22 11:06:18 +01:00
Daniel García Aubert
627b3771d3 Fix doc for layer preview 2016-11-22 11:04:38 +01:00
Raul Ochoa
f4758e84e8 Stubs next version 2016-11-11 16:17:20 +01:00
Raul Ochoa
8dfe2098ed Release 2.84.0 2016-11-11 16:16:21 +01:00
Raul Ochoa
c56a4ee036 Update news and bump version 2016-11-11 16:15:59 +01:00
Raul Ochoa
c32623b821 Stubs next version 2016-11-11 16:15:08 +01:00
Raul Ochoa
3cd0a947f7 Merge pull request #586 from CartoDB/docs-switch-to-builder
switched gui tool from editor to builder
2016-11-11 12:52:38 +01:00
Raul Ochoa
8eea1cf4e7 Merge pull request #590 from CartoDB/analyses-limits-configuration
Analyses limit configuration allows to set other limits than timeout
2016-11-11 12:52:21 +01:00
Javier Goizueta
b5fccd5bbe Merge pull request #589 from CartoDB/upgrade-camshaft-to-0.48.1
Release 2.83.1
2016-11-10 18:48:14 +01:00
Raul Ochoa
e74ce9dfd8 Analyses limit configuration allows to set other limits than timeout
Configuration is now defined as a dictionary instead of just timeouts
per analysis type
2016-11-10 18:41:59 +01:00
Javier Goizueta
3743365a83 Release 2.83.1
Upgrade camshaft to 0.48.1
2016-11-10 18:16:42 +01:00
Javier Goizueta
8aeb2173d1 Release 2.83.0 2016-11-10 13:02:39 +01:00
Javier Goizueta
9a2b17d952 Merge pull request #588 from CartoDB/upgrade-camshaft-to-0.48.0
Upgrade camshaft to 0.48.0
2016-11-10 12:47:18 +01:00
Javier Goizueta
6f54cce01a Upgrade camshaft to 0.48.0
Upgrade camshaft to have analysis limits checking
2016-11-10 12:23:15 +01:00
Daniel García Aubert
6901b2049e Release 2.82.0 2016-11-08 18:48:01 +01:00
Daniel García Aubert
d0dcc027df Upgrade camshaft to version 0.47.0 2016-11-08 18:44:58 +01:00
Daniel García Aubert
b693005118 Stubs next version 2016-11-05 14:41:15 +01:00
Daniel García Aubert
ab4a0e836f Release 2.81.1 2016-11-05 14:36:49 +01:00
Daniel
abe02db6c6 Merge pull request #585 from CartoDB/fix-map-validator-basemap
Fix issues related to rollout
2016-11-05 14:35:06 +01:00
Daniel García Aubert
a2cd5dd32d Upgrade camshaft and windshaft 2016-11-05 14:12:03 +01:00
Daniel García Aubert
49b46a6096 Use address column in styles 2016-11-05 11:43:39 +01:00
csobier
94f420ca3f switched gui tool from editor to builder 2016-11-02 09:34:55 -04:00
Daniel García Aubert
5e530105df Stubs next version 2016-11-02 14:30:11 +01:00
Daniel García Aubert
2f82d34c4b Release 2.81.0 2016-11-02 10:36:19 +01:00
Daniel García Aubert
81fd01d0ac Upgrade camshaft to 0.46.2 2016-11-01 14:49:13 +01:00
Daniel García Aubert
9faac9f9fe Retrieve error with context if map validation fails 2016-11-01 11:00:58 +01:00
Daniel García Aubert
d04787a60c Fix test 2016-10-31 22:48:09 +01:00
Daniel García Aubert
f5dbf94b52 Stubs next version 2016-10-26 14:47:59 +02:00
Daniel García Aubert
5bec2d9b15 Release 2.80.2 2016-10-26 14:34:24 +02:00
Daniel García Aubert
fe64f0c63c Update NEWS 2016-10-26 14:30:56 +02:00
Daniel García Aubert
c20fd9691a Fix order in categories query to make it compatible with lenyends 2016-10-26 13:16:24 +02:00
Daniel García Aubert
eb323fbff9 Merge branch 'master' of github.com:CartoDB/Windshaft-cartodb 2016-10-25 16:28:34 +02:00
Daniel García Aubert
211f6b9a74 Stubs next version 2016-10-25 16:27:53 +02:00
Daniel García Aubert
b6c003ec63 Stubs next version 2016-10-25 16:15:03 +02:00
Daniel García Aubert
93d4bf2a72 Release 2.80.1 2016-10-25 16:02:32 +02:00
Daniel García Aubert
c6cb573383 Since crankshaft is installed by default in template-postgis we have to remove it before running test 2016-10-25 15:55:24 +02:00
Daniel García Aubert
f4ce671ea4 Upgrade camshaft version to 0.46.1 2016-10-25 14:54:52 +02:00
Raul Ochoa
147f7cbabb Stubs next version 2016-10-20 15:24:37 +02:00
Raul Ochoa
b05d5a141e Release 2.80.0 2016-10-20 15:23:17 +02:00
Raul Ochoa
d34e0306f8 Update news 2016-10-20 15:22:16 +02:00
Raul Ochoa
bd9f48dd24 Merge pull request #579 from CartoDB/upgrade-camshaft-to-0.46.0
Upgrade camshaft to 0.46.0
2016-10-20 15:20:14 +02:00
Javier Goizueta
9805990d79 Update npm-shrinkwrap 2016-10-20 15:11:53 +02:00
Raul Ochoa
dbbe60967c Bump version and update news 2016-10-20 15:04:46 +02:00
Raul Ochoa
0ef91c1904 Merge pull request #580 from CartoDB/analyses-config-limits
Default analyses limits can be defined in configuration
2016-10-20 15:02:44 +02:00
Raul Ochoa
376573459c Default analyses limits can be defined in configuration 2016-10-20 14:03:42 +02:00
Javier Goizueta
9c6d7c0ff9 Upgrade camshaft to 0.46.0
This version of camshaft requires a CDB_CheckAnalysisQuota function
to check analysis cache quota.
2016-10-20 12:56:18 +02:00
Raul Ochoa
30a95b7da3 Stubs next version 2016-10-11 16:56:22 +02:00
Raul Ochoa
e6a60aef9a Release 2.79.0 2016-10-11 16:55:15 +02:00
Raul Ochoa
5c2024581f Bump version 2016-10-11 16:55:03 +02:00
Raul Ochoa
f7ea2bb51e Merge pull request #578 from CartoDB/upgrade-turbo-carto
Upgrades turbo-carto to 0.18.0
2016-10-11 16:53:39 +02:00
Raul Ochoa
3e4da8ab57 Upgrades turbo-carto to 0.18.0 2016-10-11 16:41:26 +02:00
Raul Ochoa
7352a28908 Fix variable assigning to itself 2016-10-11 16:01:43 +02:00
Raul Ochoa
d1928ee578 Merge pull request #577 from CartoDB/analysis-limits-configuration
Retrieve analysis limits and pass them into camshaft
2016-10-11 16:00:07 +02:00
Raul Ochoa
cd978d7384 Retrieve analysis limits and pass them into camshaft 2016-10-11 15:46:11 +02:00
Raul Ochoa
cde0d8f5e2 Stubs next version 2016-09-30 18:26:33 +02:00
Raul Ochoa
7bacfcc2e4 Release 2.78.1 2016-09-30 18:25:00 +02:00
Raul Ochoa
241fe36103 Upgrades camshaft to 0.44.2 2016-09-30 18:24:44 +02:00
Raul Ochoa
441714a656 Stubs next version 2016-09-29 11:36:06 +02:00
Raul Ochoa
bd3fdb7f16 Release 2.78.0 2016-09-29 11:35:03 +02:00
Raul Ochoa
775af6feee Merge pull request #575 from CartoDB/cartocss-meta
Add metadata about processed turbo-carto rules
2016-09-28 19:44:52 +02:00
Raul Ochoa
adf5c17e0d Use context from adapters as provider context 2016-09-28 19:22:03 +02:00
Raul Ochoa
beb2d96a32 Upgrades turbo-carto to 0.17.1 2016-09-28 19:21:43 +02:00
Raul Ochoa
2a4ae88bc0 Merge remote-tracking branch 'origin/master' into cartocss-meta 2016-09-28 17:06:36 +02:00
Raul Ochoa
b76098ba45 Upgrades turbo-carto to 0.17.0 2016-09-28 16:57:04 +02:00
Raul Ochoa
c095027f8e Regenerate npm-shrinkwrap.json 2016-09-28 14:45:33 +02:00
Raul Ochoa
9d1db19907 Regenerate npm-shrinkwrap.json for turbo-carto dep 2016-09-28 11:39:58 +02:00
Daniel García Aubert
260e321537 Stub next version 2016-09-28 11:04:03 +02:00
Daniel García Aubert
073603b527 Release 2.77.1 2016-09-28 10:55:50 +02:00
Daniel García Aubert
17b259cf31 Upgrade camshaft to version 0.44.1 2016-09-28 10:54:27 +02:00
Daniel García Aubert
8f0f0026e9 Stubs next version 2016-09-27 12:28:44 +02:00
Daniel García Aubert
59dae2b545 Release 2.77.0 2016-09-26 19:11:12 +02:00
Daniel García Aubert
4670f69ead Upgrade camshaft to version 0.44.0 2016-09-26 19:05:16 +02:00
Daniel
16fbd25a34 Merge pull request #576 from CartoDB/conf-analysis-logger
Pass logger configuration to analysis backend and create a stream
2016-09-26 18:14:52 +02:00
Daniel García Aubert
2d75985cb3 Recreate stream on SIGHUP event 2016-09-26 17:39:27 +02:00
Daniel García Aubert
f963fb321e Set default config of analysis logger for test env 2016-09-23 17:35:46 +02:00
Daniel García Aubert
10feea0d48 Pass logger configuration to analysis backend and create a stream based on config 2016-09-23 17:11:04 +02:00
Raul Ochoa
b6b9b0ac36 Regenerate npm-shrinkwrap 2016-09-21 17:13:59 +02:00
Raul Ochoa
5551e85853 Update news and bump version 2016-09-21 16:06:43 +02:00
Raul Ochoa
1f0fa5031b Rely on turbo-carto metadata branch 2016-09-20 16:19:46 +02:00
Raul Ochoa
263294a3f5 Add metadata only for existing layers in turbocarto context 2016-09-20 16:19:22 +02:00
Raul Ochoa
f9df30f70b Append turbo-carto metadata per layer 2016-09-20 16:09:21 +02:00
Raul Ochoa
61d31ec054 Handle metadata from turbo-carto 2016-09-20 16:08:53 +02:00
Raul Ochoa
c8917bfc4c Return stats in callback 2016-09-20 16:00:33 +02:00
Raul Ochoa
36b69a05e5 Compute some stats in queries 2016-09-20 16:00:06 +02:00
Raul Ochoa
c8d2f66467 Stubs next version 2016-09-15 12:14:12 +02:00
Raul Ochoa
7416bb0e56 Release 2.76.0 2016-09-15 12:13:36 +02:00
Raul Ochoa
9182d0132d Merge pull request #574 from CartoDB/travis-addon
Travis' pg 9.5 addon
2016-09-15 11:17:51 +02:00
Raul Ochoa
9be9357ade Add libpango 2016-09-15 01:57:49 +02:00
Raul Ochoa
7f414f8adf Attempt to use travis' pg 9.5 addon 2016-09-15 01:51:36 +02:00
Raul Ochoa
3af9549939 Merge pull request #573 from CartoDB/external-config
Allow to use `--config /path/to/config.js` to specify configuration file
2016-09-15 01:49:43 +02:00
Raul Ochoa
41f248d731 Use logError 2016-09-15 01:35:38 +02:00
Raul Ochoa
18a517b7bf Allow to use --config /path/to/config.js to specify configuration file 2016-09-15 01:25:33 +02:00
Raul Ochoa
5150204389 Travis' Node.js 0.10 already uses npm 2.x 2016-09-14 21:22:40 +02:00
Raul Ochoa
3b16e7729d Merge pull request #572 from CartoDB/logs-conf
Allow to use absolute paths for log files
2016-09-14 21:04:19 +02:00
Raul Ochoa
76d27c9fce Allow to use absolute paths for log files
Fixes #570
2016-09-14 20:15:38 +02:00
Raul Ochoa
4ce6e41000 Stubs next version 2016-09-14 20:06:05 +02:00
Daniel García Aubert
33260cdbd9 Release 2.75.0 2016-09-14 09:48:20 +02:00
Raul Ochoa
85d81ba7fd Upgrades camshaft to 0.42.2 2016-09-09 13:40:31 +02:00
Raul Ochoa
7e8a3ca21f Stubs next version 2016-09-07 17:01:39 +02:00
Raul Ochoa
e9e4dc1f5c Release 2.74.1 2016-09-07 17:00:23 +02:00
Raul Ochoa
17c30e165a Upgrades camshaft to 0.42.1
Test fixture updated as it no longers generate bounds based on
table estimated bounds
2016-09-07 16:43:18 +02:00
Daniel García Aubert
c45c6ceb15 Stubs next version 2016-09-06 19:10:58 +02:00
Daniel García Aubert
d73c2c465f Release 2.74.0 2016-09-06 19:03:50 +02:00
Daniel
d4fc53939b Merge pull request #568 from CartoDB/567-show-hide-named-maps
Show & hide support in named maps
2016-09-06 18:53:23 +02:00
Daniel García Aubert
4becb65bec Stubs next version 2016-09-06 16:33:21 +02:00
Daniel García Aubert
f64e16c790 Release 2.73.1 2016-09-06 16:27:12 +02:00
Daniel García Aubert
1772011627 Add missinng column in fixture table cdb_analysis_catalog 2016-09-06 16:19:06 +02:00
Raul Ochoa
5b8f785e2b Regenerate npm-shrinkwrap.json 2016-09-06 16:01:05 +02:00
Daniel García Aubert
a0e3b77006 Release 2.73.0 2016-09-06 15:51:03 +02:00
Daniel García Aubert
908070ecd7 Fix jshint issue 2016-09-01 16:53:10 +02:00
Daniel García Aubert
7c6a58cd30 Made explicit to recreate named-map-provider 2016-09-01 16:42:06 +02:00
Daniel García Aubert
b0990a1132 Removed template-maps backend from named-maps controller 2016-09-01 16:31:30 +02:00
Daniel García Aubert
c6988cdb88 Improved and implemented new test for layer visibility suite 2016-09-01 12:37:56 +02:00
Daniel García Aubert
e0d304b033 Applied approach similar to static image options 2016-09-01 12:37:04 +02:00
Daniel García Aubert
e4a9f2d64c Added template map as dependency of named maps controller 2016-09-01 12:35:35 +02:00
Daniel García Aubert
0236fe3ca9 Implemented new scenario 2016-08-31 20:41:07 +02:00
Daniel García Aubert
1bed8623a2 Overwrites rendererparams instead of layergroup in mapconfig 2016-08-31 20:40:55 +02:00
Daniel García Aubert
df7d957914 Implemented acceptance test for layer visibility in previews 2016-08-31 19:41:23 +02:00
Daniel García Aubert
30c4b00f33 New approach: decorates named_map_provider to return the with visible layers 2016-08-31 19:40:00 +02:00
Daniel García Aubert
ab27886460 Renamed option by for name maps template 2016-08-31 19:37:48 +02:00
Daniel García Aubert
31e18d04d7 Undo unneeded optimization 2016-08-31 13:57:28 +02:00
Daniel García Aubert
8155484510 Improved test visibility layer with layerId 2016-08-29 10:46:55 +02:00
Daniel García Aubert
b61f1d2b53 Attached layer_visibility property to the named template 2016-08-26 17:30:03 +02:00
Daniel García Aubert
2e274b936a Improved test to check all possible values of visibility in named maps templates 2016-08-26 15:07:06 +02:00
Daniel García Aubert
bf3e311b57 Avoid unnecessary complexity 2016-08-26 14:46:23 +02:00
Daniel García Aubert
6a7613de6b Improved layergroup instantiation to filter non visible layers 2016-08-26 14:42:33 +02:00
Daniel García Aubert
ee46549e04 First approach 2016-08-25 20:04:23 +02:00
Raul Ochoa
377f3d4aff Removes constraint on filtered mapnik layers 2016-08-25 18:34:19 +02:00
Daniel García Aubert
752d47d71e Stubs next version 2016-08-23 11:25:39 +02:00
Daniel García Aubert
367157b80c Release 2.72.0 2016-08-23 11:19:48 +02:00
Daniel García Aubert
53542f1cd6 Stubs next version 2016-08-17 15:15:18 +02:00
Daniel García Aubert
7a8f156abf Release 2.71.0 2016-08-17 15:12:42 +02:00
Daniel García Aubert
c60cc57a0d Upgrades Windshaft to version 2.5.0 2016-08-17 15:07:29 +02:00
Raul Ochoa
8de6ec9a21 Stubs next version 2016-08-16 12:25:12 +02:00
Raul Ochoa
44b6f4be7e Release 2.70.0 2016-08-16 12:24:23 +02:00
Raul Ochoa
280be1751c Merge pull request #565 from CartoDB/update-camshaft
Upgrade camshaft to 0.40.0
2016-08-16 12:19:25 +02:00
Raul Ochoa
701a73a2c5 Upgrade camshaft to 0.40.0 2016-08-16 11:33:32 +02:00
Raul Ochoa
b578eada07 Stubs next version 2016-08-12 10:34:33 +02:00
Raul Ochoa
8100f155dc Release 2.69.1 2016-08-12 10:33:10 +02:00
Raul Ochoa
9f1a014004 Upgrades windshaft to 2.4.2 2016-08-12 10:24:06 +02:00
Raul Ochoa
e35e0e157c Stubs next version 2016-08-11 12:06:33 +02:00
Raul Ochoa
3aff328af3 Release 2.69.0 2016-08-11 12:05:56 +02:00
Raul Ochoa
ffb086045a Bump version 2016-08-11 12:05:37 +02:00
Raul Ochoa
c0786dfa6f Merge pull request #564 from CartoDB/fix-travis
Avoid 'No such file or directory'
2016-08-10 12:59:29 +02:00
Raul Ochoa
ddc33fa52b Avoid 'No such file or directory' 2016-08-10 10:30:04 +02:00
Raul Ochoa
9f2d6a5d41 Merge pull request #563 from CartoDB/upgrade-camshaft
Upgrade camshaft to 0.39.0
2016-08-09 17:01:09 +02:00
Raul Ochoa
64e884a092 force-yes for postgresql-plpython-9.5 2016-08-09 15:45:21 +02:00
Raul Ochoa
17ec174683 Use --force-yes 2016-08-09 15:41:17 +02:00
Raul Ochoa
3666cbee94 Upgrade camshaft to 0.39.0 2016-08-09 15:29:54 +02:00
Raul Ochoa
25de018f7d Add comment about row_limit config parameter 2016-08-01 12:59:38 +02:00
Raul Ochoa
6597851b48 Stubs next version 2016-07-21 21:04:39 +02:00
Raul Ochoa
0399131968 Release 2.68.0 2016-07-21 21:03:10 +02:00
Raul Ochoa
86836e7f89 Upgrades turbo-carto to 0.16.0 2016-07-21 21:02:06 +02:00
Daniel García Aubert
df346b11d3 Release 2.67.1 2016-07-21 16:05:12 +02:00
Daniel García Aubert
27f74b3fe2 Stubs next version 2016-07-21 10:41:42 +02:00
Daniel García Aubert
87dec64ad1 Release 2.67.0 2016-07-21 10:34:10 +02:00
Daniel García Aubert
54c787162a Update NEWS 2016-07-21 10:27:46 +02:00
Daniel García Aubert
6e92e699dc Upgrades camshaft version to 0.38.0 2016-07-21 10:25:53 +02:00
Raul Ochoa
7950f43db3 Stubs next version 2016-07-20 19:38:09 +02:00
Raul Ochoa
d300677315 Release 2.66.2 2016-07-20 19:26:27 +02:00
Raul Ochoa
bd4d29dd14 Upgrades turbo-carto to 0.15.1 2016-07-20 19:25:53 +02:00
Raul Ochoa
18a84433f4 Merge pull request #562 from CartoDB/git-for-log4js-dep
Use git for log4js dependency
2016-07-20 19:21:02 +02:00
Raul Ochoa
768ebf0ef2 Use git for log4js dependency 2016-07-20 18:34:57 +02:00
Raul Ochoa
1c20cb5478 Stubs next version 2016-07-20 11:20:12 +02:00
Raul Ochoa
279587ea11 Release 2.66.1 2016-07-20 11:16:23 +02:00
Raul Ochoa
25df193390 Merge pull request #560 from CartoDB/upgrade-turbo-carto
Upgrades turbo-carto to 0.15.0
2016-07-19 20:03:30 +02:00
Raul Ochoa
9ce81693bd Merge remote-tracking branch 'origin/master' into upgrade-turbo-carto
Conflicts:
	npm-shrinkwrap.json
2016-07-19 19:46:19 +02:00
Raul Ochoa
16765e092f Upgrades turbo-carto to 0.15.0 2016-07-19 19:28:53 +02:00
Daniel García Aubert
237e1257c4 Stubs next version 2016-07-18 13:34:14 +02:00
Daniel García Aubert
665859b17d Release 2.66.0 2016-07-18 13:31:55 +02:00
Raul Ochoa
b5a6d6974c Do not cast type in category ramp 2016-07-18 11:58:19 +02:00
Raul Ochoa
26bab029f4 Prepare for new turbo-carto versio 2016-07-18 11:57:27 +02:00
Raul Ochoa
ed7bb07b03 Output actual error message 2016-07-18 11:13:37 +02:00
Raul Ochoa
c87277ad01 Adjust to fail in specific scenario 2016-07-18 11:13:01 +02:00
Raul Ochoa
62be259a90 Rename turbo-cartocss -> turbo-carto 2016-07-18 10:29:13 +02:00
Daniel García Aubert
80798f984b Stubs next version 2016-07-15 12:15:47 +02:00
475 changed files with 60796 additions and 27615 deletions

View File

@@ -1,4 +1,3 @@
test/results/
test/monkey/
test/benchmark.js
test/support/

22
.eslintrc.js Normal file
View File

@@ -0,0 +1,22 @@
module.exports = {
env: {
commonjs: true,
es6: true,
node: true,
mocha: true
},
extends: [
'standard'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaVersion: 2018
},
rules: {
"indent": ["error", 4],
"semi": ["error", "always"]
}
}

58
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: continuous integration
on:
pull_request:
paths-ignore:
- 'LICENSE'
- 'README**'
- 'HOW_TO_RELEASE**'
- 'LOGGING**'
env:
GCLOUD_VERSION: '306.0.0'
ARTIFACTS_PROJECT_ID: cartodb-on-gcp-main-artifacts
jobs:
build-test-docker:
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.CARTOFANTE_PERSONAL_TOKEN }}
- name: Build image
# we tag with "latest" but we don't push it on purpose. We use it as a base for the testing image
run: |
echo ${GITHUB_SHA::7}
echo ${GITHUB_REF##*/}
docker build -f private/Dockerfile -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:latest -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/} -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_SHA::7} -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}--${GITHUB_SHA::7} .
- name: Build testing image
# here it uses the lastest from prev step to add the needed parts on top
run: |
docker build -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft-test:latest -f private/Dockerfile.test .
- name: Setup gcloud authentication
uses: google-github-actions/setup-gcloud@master
with:
version: ${{env.GCLOUD_VERSION}}
service_account_key: ${{ secrets.ARTIFACTS_GCLOUD_ACCOUNT_BASE64 }}
- name: Configure docker and pull images
# we pull images manually, as if done in next step using docker-compose it fails because missing openssl
run: |
gcloud auth configure-docker
docker pull gcr.io/cartodb-on-gcp-main-artifacts/postgres:latest
docker pull gcr.io/cartodb-on-gcp-main-artifacts/redis:latest
- name: Run tests inside container
run: docker-compose -f private/ci/docker-compose.yml run windshaft-tests
- name: Upload image
run: |
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_SHA::7}
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}--${GITHUB_SHA::7}

47
.github/workflows/master.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
# in this workflow we don't run the tests. Only build image, tag (also latests) and upload. The tests are not run because they are run
# on each pull request, and there is a branch protection that forces to have branch up to date before merging, so tests are always run
# with the latest code
name: master build image
on:
push:
branches:
- master
env:
GCLOUD_VERSION: '306.0.0'
ARTIFACTS_PROJECT_ID: cartodb-on-gcp-main-artifacts
jobs:
build-master:
runs-on: ubuntu-18.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.CARTOFANTE_PERSONAL_TOKEN }}
- name: Build image
run: |
echo ${GITHUB_SHA::7}
echo ${GITHUB_REF##*/}
docker build -f private/Dockerfile -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:latest -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/} -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_SHA::7} .
- name: Setup gcloud authentication
uses: google-github-actions/setup-gcloud@master
with:
version: ${{env.GCLOUD_VERSION}}
service_account_key: ${{ secrets.ARTIFACTS_GCLOUD_ACCOUNT_BASE64 }}
- name: Configure docker
run: |
gcloud auth configure-docker
- name: Upload image
run: |
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_SHA::7}
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:latest

9
.gitignore vendored
View File

@@ -2,10 +2,15 @@ node_modules*
config.status*
config/environments/*.js
.idea
.vscode
.nvmrc
tools/munin/windshaft.conf
logs/
pids/
redis.pid
test.log
npm-debug.log
*.log
coverage/
.DS_Store
.nyc_output
build_resources/
.dockerignore

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "private"]
path = private
url = git@github.com:CartoDB/Windshaft-cartodb-private.git
branch = master

View File

@@ -1,95 +0,0 @@
{
// // JSHint Default Configuration File (as on JSHint website)
// // See http://jshint.com/docs/ for more details
//
// "maxerr" : 50, // {int} Maximum error before stopping
//
// // Enforcing
// "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
// "camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
// "indent" : 4, // {int} Number of spaces to use for indentation
// "latedef" : false, // true: Require variables/functions to be defined before being used
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
// "noempty" : true, // true: Prohibit use of empty blocks
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
"nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
// "plusplus" : false, // true: Prohibit use of `++` & `--`
// "quotmark" : false, // Quotation mark consistency:
// // false : do nothing (default)
// // true : ensure whatever is used is consistent
// // "single" : require single quotes
// // "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : true, // true: Require all defined variables be used
// "strict" : true, // true: Requires all functions run in ES5 Strict Mode
// "maxparams" : false, // {int} Max number of formal params allowed per function
// "maxdepth" : false, // {int} Max depth of nested blocks (within functions)
// "maxstatements" : false, // {int} Max number statements per function
"maxcomplexity" : 6, // {int} Max cyclomatic complexity per function
"maxlen" : 120, // {int} Max number of characters per line
//
// // Relaxing
// "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
// "boss" : false, // true: Tolerate assignments where comparisons would be expected
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
// "eqnull" : false, // true: Tolerate use of `== null`
// "es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
// "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
// "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// // (ex: `for each`, multiple try/catch, function expression…)
// "evil" : false, // true: Tolerate use of `eval` and `new Function()`
// "expr" : false, // true: Tolerate `ExpressionStatement` as Programs
// "funcscope" : false, // true: Tolerate defining variables inside control statements
// "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
// "iterator" : false, // true: Tolerate using the `__iterator__` property
// "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
// "laxbreak" : false, // true: Tolerate possibly unsafe line breakings
// "laxcomma" : false, // true: Tolerate comma-first style coding
// "loopfunc" : false, // true: Tolerate functions being defined in loops
// "multistr" : false, // true: Tolerate multi-line strings
// "noyield" : false, // true: Tolerate generator functions with no yield statement in them.
// "notypeof" : false, // true: Tolerate invalid typeof operator values
// "proto" : false, // true: Tolerate using the `__proto__` property
// "scripturl" : false, // true: Tolerate script-targeted URLs
// "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
// "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
// "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
// "validthis" : false, // true: Tolerate using this in a non-constructor function
//
// // Environments
// "browser" : true, // Web Browser (window, document, etc)
// "browserify" : false, // Browserify (node.js code in the browser)
// "couch" : false, // CouchDB
// "devel" : true, // Development/debugging (alert, confirm, etc)
// "dojo" : false, // Dojo Toolkit
// "jasmine" : false, // Jasmine
// "jquery" : false, // jQuery
// "mocha" : true, // Mocha
// "mootools" : false, // MooTools
"node" : true, // Node.js
// "nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
// "prototypejs" : false, // Prototype and Scriptaculous
// "qunit" : false, // QUnit
// "rhino" : false, // Rhino
// "shelljs" : false, // ShellJS
// "worker" : false, // Web Workers
// "wsh" : false, // Windows Scripting Host
// "yui" : false, // Yahoo User Interface
// Custom predefined global variables
"predef": [
"-console", // disallows console, use debug
"beforeEach",
"afterEach",
"before",
"after",
"describe",
"it"
]
}

View File

@@ -1,37 +0,0 @@
addons:
apt:
packages:
- pkg-config
- libcairo2-dev
- libjpeg8-dev
- libgif-dev
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
env:
- NPROCS=1 JOBS=1 PGUSER=postgres
language: node_js
node_js:
- "0.10"
notifications:
irc:
channels:
- "irc.freenode.org#cartodb"
use_notice: true

View File

@@ -1,11 +0,0 @@
Contributing
---
The issue tracker is at [github.com/CartoDB/Windshaft-cartodb](https://github.com/CartoDB/Windshaft-cartodb).
We love pull requests from everyone, see [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/#contributing).
## Submitting Contributions
* You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://cartodb.com/contributing).

View File

@@ -1,19 +0,0 @@
1. Test (make clean all check), fix if broken before proceeding
2. Ensure proper version in package.json
3. Ensure NEWS section exists for the new version, review it, add release date
4. Recreate npm-shrinkwrap.json with: `npm install --no-shrinkwrap && npm shrinkwrap`
5. Commit package.json, npm-shrinwrap.json, NEWS
6. git tag -a Major.Minor.Patch # use NEWS section as content
7. Announce on cartodb@googlegroups.com
8. Stub NEWS/package for next version
Versions:
Bugfix releases increment Patch component of version.
Feature releases increment Minor and set Patch to zero.
If backward compatibility is broken, increment Major and
set to zero Minor and Patch.
Branches named 'b<Major>.<Minor>' are kept for any critical
fix that might need to be shipped before next feature release
is ready.

16
HOW_TO_RELEASE.md Normal file
View File

@@ -0,0 +1,16 @@
# How to release
1. Test (npm test), fix if broken before proceeding.
2. Ensure proper version in `package.json` and `package-lock.json`.
3. Ensure NEWS section exists for the new version, review it, add release date.
4. If there are modified dependencies in `package.json`, update them with `npm upgrade {{package_name}}@{{version}}`.
5. Commit `package.json`, `package-lock.json`, NEWS.
6. Run `git tag -a Major.Minor.Patch`. Use NEWS section as content.
7. Stub NEWS/package for next version.
## Version:
* Bugfix releases increment Patch component of version.
* Feature releases increment Minor and set Patch to zero.
* If backward compatibility is broken, increment Major and set to zero Minor and Patch.
* Branches named 'b<Major>.<Minor>' are kept for any critical fix that might need to be shipped before next feature release is ready.

View File

@@ -1,53 +0,0 @@
# Installing Windshaft-CartoDB #
## Requirements ##
Make sure that you have the requirements needed. These are
- Core
- Node.js >=0.8
- npm >=1.2.1 <2.0.0
- PostgreSQL >8.3.x, PostGIS >1.5.x
- Redis >2.4.0 (http://www.redis.io)
- Mapnik 2.0.1, 2.0.2, 2.1.0, 2.2.0, 2.3.0. See [Installing Mapnik](https://github.com/CartoDB/Windshaft#installing-mapnik).
- Windshaft: check [Windshaft dependencies and installation notes](https://github.com/CartoDB/Windshaft#dependencies)
- libcairo2-dev, libpango1.0-dev, libjpeg8-dev and libgif-dev for server side canvas support
- For cache control (optional)
- CartoDB 0.9.5+ (for `CDB_QueryTables`)
- Varnish (http://www.varnish-cache.org)
On Ubuntu 14.04 the dependencies can be installed with
```shell
sudo apt-get update
sudo apt-get install -y make g++ pkg-config git-core \
libgif-dev libjpeg-dev libcairo2-dev \
libhiredis-dev redis-server \
nodejs nodejs-legacy npm \
postgresql-9.3-postgis-2.1 postgresql-plpython-9.3 postgresql-server-dev-9.3
```
On Ubuntu 12.04 the [cartodb/cairo PPA](https://launchpad.net/~cartodb/+archive/ubuntu/cairo) may be useful.
## PostGIS setup ##
A `template_postgis` database is expected. One can be set up with
```shell
createdb --owner postgres --template template0 template_postgis
psql -d template_postgis -c 'CREATE EXTENSION postgis;'
```
## Build/install ##
To fetch and build all node-based dependencies, run:
```
npm install
```
Note that the ```npm install``` step will populate the node_modules/
directory with modules, some of which being compiled on demand. If you
happen to have startup errors you may need to force rebuilding those
modules. At any time just wipe out the node_modules/ directory and run
```npm install``` again.

21
LOGGING.md Normal file
View File

@@ -0,0 +1,21 @@
# Logging structured traces
In order to have meaningful and useful log traces, you should follow
some general guidelines described in the [Project Guidelines](http://doc-internal.cartodb.net/platform/guidelines.html#structured-logging).
In this project there is a specific logger in place that takes care of
format and context of the traces for you. Take a look at [logger.js](https://github.com/CartoDB/Windshaft-cartodb/blob/cf82e1954e2244861e47fce0c2223ee466a5cd64/lib/utils/logger.js)
(NOTE: that file will be moved soon to a common module).
The logger is instantiated as part of the [app startup process](https://github.com/CartoDB/Windshaft-cartodb/blob/cf82e1954e2244861e47fce0c2223ee466a5cd64/app.js#L53),
then passed to middlewares and other client classes.
There are many examples of how to use the logger to generate traces
throughout the code. Here are a few of them:
```js
lib/api/middlewares/logger.js: res.locals.logger.info({ client_request: req }, 'Incoming request');
lib/api/middlewares/logger.js: res.on('finish', () => res.locals.logger.info({ server_response: res, status: res.statusCode }, 'Response sent'));
lib/api/middlewares/profiler.js: logger.info({ stats, duration: stats.response / 1000, duration_ms: stats.response }, 'Request profiling stats');
lib/api/middlewares/tag.js: res.on('finish', () => logger.info({ tags: res.locals.tags }, 'Request tagged'));
```

View File

@@ -1,53 +0,0 @@
SHELL=/bin/bash
pre-install:
@$(SHELL) ./scripts/check-node-canvas.sh
all:
@$(SHELL) ./scripts/install.sh
clean:
rm -rf node_modules/*
distclean: clean
rm config.status*
config.status--test:
./configure --environment=test
config/environments/test.js: config.status--test
./config.status--test
TEST_SUITE := $(shell find test/{acceptance,integration,unit} -name "*.js")
TEST_SUITE_UNIT := $(shell find test/unit -name "*.js")
TEST_SUITE_INTEGRATION := $(shell find test/integration -name "*.js")
TEST_SUITE_ACCEPTANCE := $(shell find test/acceptance -name "*.js")
test: config/environments/test.js
@echo "***tests***"
@$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE)
test-unit: config/environments/test.js
@echo "***tests***"
@$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_UNIT)
test-integration: config/environments/test.js
@echo "***tests***"
@$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_INTEGRATION)
test-acceptance: config/environments/test.js
@echo "***tests***"
@$(SHELL) ./run_tests.sh ${RUNTESTFLAGS} $(TEST_SUITE_ACCEPTANCE)
jshint:
@echo "***jshint***"
@./node_modules/.bin/jshint lib/ test/ app.js
test-all: test jshint
coverage:
@RUNTESTFLAGS=--with-coverage make test
check: test
.PHONY: pre-install test jshint coverage

1195
NEWS.md

File diff suppressed because it is too large Load Diff

204
README.md
View File

@@ -1,82 +1,146 @@
Windshaft-CartoDB
==================
# Windshaft-CartoDB [![Build Status](https://travis-ci.org/CartoDB/Windshaft-cartodb.svg?branch=master)](https://travis-ci.org/CartoDB/Windshaft-cartodb)
[![Build Status](https://travis-ci.org/CartoDB/Windshaft-cartodb.svg?branch=master)](https://travis-ci.org/CartoDB/Windshaft-cartodb)
The [`CARTO Maps API`](https://carto.com/developers/maps-api/) tiler. It extends [`Windshaft`](https://github.com/CartoDB/Windshaft) and exposes a web service with extra functionality:
This is the [CartoDB Maps API](http://docs.cartodb.com/cartodb-platform/maps-api.html) tiler. It extends
[Windshaft](https://github.com/CartoDB/Windshaft) with some extra functionality and custom filters for authentication.
* Instantiate [`Anonymous Maps`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/03-anonymous-maps.md) through CARTO's map configuration ([`MapConfig`](https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-specification.md)).
* Create [`Named Maps`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/04-named-maps.md) based on customizable templates.
* Get map previews through [`Static Maps`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/05-static-maps-API.md) API.
* Render maps with a large amount of data faster using [`Tile Aggregation`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/06-tile-aggregation.md).
* Build advanced maps with enriched data through [`Analyses Extension`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/09-MapConfig-analyses-extension.md).
* Fetch tabular data from analysis nodes with [`Dataviews`](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/guides/10-MapConfig-dataviews-extension.md)
* reads dbname from subdomain and cartodb redis for pretty tile urls
* configures windshaft to publish `cartodb_id` as the interactivity layer
* gets the default geometry type from the cartodb redis store
* allows tiles to be styled individually
* provides a link to varnish high speed cache
* provides a [template maps API](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/Template-maps.md)
## Build
Install
-------
See [INSTALL.md](INSTALL.md) for detailed installation instructions.
Requirements:
Configure
---------
* [`Node 12.x `](https://nodejs.org/dist/latest-v10.x/)
* [`PostgreSQL >= 11.0`](https://www.postgresql.org/download/)
* [`PostGIS >= 2.4`](https://postgis.net/install/)
* [`CARTO Postgres Extension >= 0.24.1`](https://github.com/CartoDB/cartodb-postgresql)
* [`Redis >= 4`](https://redis.io/download)
* `libcairo2-dev`, `libpango1.0-dev`, `libjpeg8-dev` and `libgif-dev` for server side canvas support
* `C++11` to build internal dependencies. When there's no pre-built binaries for your OS/architecture distribution.
Create the config/environments/<env>.js files (there are .example files
to start from). You can optionally use the ./configure script for this,
see ```./configure --help``` to see available options.
Optional:
Look at lib/cartodb/server_options.js for more on config
* [`Varnish`](http://www.varnish-cache.org)
* [`Statsd`](https://github.com/statsd/statsd)
Upgrading
---------
### PostGIS setup
Checkout your commit/branch. If you need to reinstall dependencies (you can check [NEWS](NEWS.md)) do the following:
```
rm -rf node_modules; npm install
```
Run
---
```
node app.js <env>
```
Where <env> is the name of a configuration file under config/environments/.
Note that caches are kept in redis. If you're not seeing what you expect
there may be out-of-sync records in there.
Take a look: http://redis.io/commands
Documentation
-------------
The [docs directory](https://github.com/CartoDB/Windshaft-cartodb/tree/master/docs) contains different documentation
resources, from higher level to more detailed ones:
The [Maps API](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/Map-API.md) defined the endpoints and their
expected parameters and outputs.
Examples
--------
[CartoDB's Map Gallery](http://cartodb.com/gallery/) showcases several examples of visualisations built on top of this.
Contributing
---
See [CONTRIBUTING.md](CONTRIBUTING.md).
### Developing with a custom windshaft version
If you plan or want to use a custom / not released yet version of windshaft (or any other dependency) the best option is
to use `npm link`. You can read more about it at [npm-link: Symlink a package folder](https://docs.npmjs.com/cli/link).
**Quick start**:
A `template_postgis` database is expected. One can be set up with
```shell
~/windshaft-directory $ npm install
~/windshaft-directory $ npm link
~/windshaft-cartodb-directory $ npm link windshaft
$ createdb --owner postgres --template template0 template_postgis
$ psql -d template_postgis -c 'CREATE EXTENSION postgis;'
```
### Install
To fetch and build all node-based dependencies, run:
```shell
$ npm install
```
### Run
You can inject the configuration through environment variables at run time. Check the file `./config/environments/config.js` to see the ones you have available.
While the migration to the new environment based configuration, you can still use the old method of copying a config file. To enabled the one with environment variables you need to pass `CARTO_WINDSHAFT_ENV_BASED_CONF=true`. You can use the docker image to run it.
Old way:
```shell
$ node app.js <env>
```
Where `<env>` is the name of a configuration file under `./config/environments/`.
### Test
You can easily run the tests against the dependencies from the `dev-env`. To do so, you need to build the test docker image:
```shell
$ docker-compose build
```
Then you can run the tests like:
```shell
$ docker-compose run windshaft-tests
```
It will mount your code inside a volume. In case you want to play and run `npm test` or something else you can do:
```shell
$ docker-compose run --entrypoint bash windshaft-tests
```
So you will have a bash shell inside the test container, with the code from your host.
### Coverage
```shell
$ npm run cover
```
Open `./coverage/lcov-report/index.html`.
### Docker support
We provide docker images just for testing and continuous integration purposes:
* [`nodejs-xenial-pg1121`](https://hub.docker.com/r/carto/nodejs-xenial-pg1121/tags)
* [`nodejs-xenial-pg101`](https://hub.docker.com/r/carto/nodejs-xenial-pg101/tags)
You can find instructions to install Docker, download, and update images [here](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docker/reference.md).
### Useful `npm` scripts
Run test in a docker image with a specific Node.js version:
```shell
$ DOCKER_IMAGE=<docker-image-tag> NODE_VERSION=<nodejs-version> npm run test:docker
```
Where:
* `<docker-image-tag>`: the tag of required docker image, e.g. `carto/nodejs-xenial-pg1121:latest`
* `<nodejs-version>`: the Node.js version, e.g. `10.15.1`
In case you need to debug:
```shell
$ DOCKER_IMAGE=<docker-image-tag> npm run docker:bash
```
## Documentation
You can find an overview, guides, full reference, and support in [`CARTO's developer center`](https://carto.com/developers/maps-api/). The [docs directory](https://github.com/CartoDB/Windshaft-cartodb/tree/master/docs) contains different documentation resources, from a higher level to more detailed ones.
## Contributing
* The issue tracker: [`Github`](https://github.com/CartoDB/Windshaft-cartodb/issues).
* We love Pull Requests from everyone, see [contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/#contributing).
* You'll need to sign a Contributor License Agreement (CLA) before submitting a Pull Request. [Learn more here](https://carto.com/contributions).
## Developing with a custom `Windshaft` version
If you plan or want to use a custom / not released yet version of windshaft (or any other dependency), the best option is to use `npm link`. You can read more about it at `npm-link`: [symlink a package folder](https://docs.npmjs.com/cli/link.html).
```shell
$ cd /path/to/Windshaft
$ npm install
$ npm link
$ cd /path/to/Windshaft-cartodb
$ npm link windshaft
```
## Versioning
We follow [`SemVer`](http://semver.org/) for versioning. For available versions, see the [tags on this repository](https://github.com/CartoDB/Windshaft-cartodb/tags).
## License
This project is licensed under the BSD 3-clause "New" or "Revised" License. See the [LICENSE](LICENSE) file for details.

277
app.js
View File

@@ -1,47 +1,39 @@
var http = require('http');
var https = require('https');
var path = require('path');
var fs = require('fs');
'use strict';
var _ = require('underscore');
const http = require('http');
const https = require('https');
const path = require('path');
const semver = require('semver');
var ENVIRONMENT;
if ( process.argv[2] ) {
ENVIRONMENT = process.argv[2];
} else if ( process.env.NODE_ENV ) {
ENVIRONMENT = process.env.NODE_ENV;
} else {
ENVIRONMENT = 'development';
// TODO: research it it's still needed
const setICUEnvVariable = require('./lib/utils/icu-data-env-setter');
// This function should be called before the require('yargs').
setICUEnvVariable();
const argv = require('yargs')
.usage('Usage: node $0 <environment> [options]')
.help('h')
.example(
'node $0 production -c /etc/windshaft-cartodb/config.js',
'start server in production environment with /etc/windshaft-cartodb/config.js as config file'
)
.alias('h', 'help')
.alias('c', 'config')
.nargs('c', 1)
.describe('c', 'Load configuration from path')
.argv;
const environmentArg = argv._[0] || process.env.NODE_ENV || 'development';
let configFileName = environmentArg;
if (process.env.CARTO_WINDSHAFT_ENV_BASED_CONF) {
// we override the file with the one with env vars
configFileName = 'config';
}
const configurationFile = path.resolve(argv.config || `./config/environments/${configFileName}.js`);
// jshint undef:false
var log = console.log.bind(console);
var logError = console.error.bind(console);
// jshint undef:true
var availableEnvironments = {
production: true,
staging: true,
development: true
};
// sanity check
if (!availableEnvironments[ENVIRONMENT]){
logError('node app.js [environment]');
logError('environments: %s', Object.keys(availableEnvironments).join(', '));
process.exit(1);
}
process.env.NODE_ENV = ENVIRONMENT;
// set environment specific variables
global.environment = require('./config/environments/' + ENVIRONMENT);
global.log4js = require('log4js');
var log4js_config = {
appenders: [],
replaceConsole: true
};
global.environment = require(configurationFile);
process.env.NODE_ENV = argv._[0] || process.env.NODE_ENV || global.environment.environment;
if (global.environment.uv_threadpool_size) {
process.env.UV_THREADPOOL_SIZE = global.environment.uv_threadpool_size;
@@ -49,77 +41,180 @@ if (global.environment.uv_threadpool_size) {
// set global HTTP and HTTPS agent default configurations
// ref https://nodejs.org/api/http.html#http_new_agent_options
var agentOptions = _.defaults(global.environment.httpAgent || {}, {
const agentOptions = Object.assign({
keepAlive: false,
keepAliveMsecs: 1000,
maxSockets: Infinity,
maxFreeSockets: 256
});
}, global.environment.httpAgent || {});
http.globalAgent = new http.Agent(agentOptions);
https.globalAgent = new https.Agent(agentOptions);
if ( global.environment.log_filename ) {
var logdir = path.dirname(global.environment.log_filename);
// See cwd inlog4js.configure call below
logdir = path.resolve(__dirname, logdir);
if ( ! fs.existsSync(logdir) ) {
logError("Log filename directory does not exist: " + logdir);
process.exit(1);
}
log("Logs will be written to " + global.environment.log_filename);
log4js_config.appenders.push(
{ type: "file", filename: global.environment.log_filename }
);
} else {
log4js_config.appenders.push(
{ type: "console", layout: { type:'basic' } }
);
}
global.log4js.configure(log4js_config, { cwd: __dirname });
global.logger = global.log4js.getLogger();
global.environment.api_hostname = require('os').hostname().split('.')[0];
// Include cartodb_windshaft only _after_ the "global" variable is set
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/28
var cartodbWindshaft = require('./lib/cartodb/server');
var serverOptions = require('./lib/cartodb/server_options');
const createServer = require('./lib/server');
const serverOptions = require('./lib/server-options');
const { logger } = serverOptions;
var server = cartodbWindshaft(serverOptions);
const availableEnvironments = {
production: true,
staging: true,
development: true
};
// Maximum number of connections for one process
// 128 is a good number if you have up to 1024 filedescriptors
// 4 is good if you have max 32 filedescriptors
// 1 is good if you have max 16 filedescriptors
var backlog = global.environment.maxConnections || 128;
if (!availableEnvironments[process.env.NODE_ENV]) {
logger.fatal(new Error(`Invalid environment ${process.env.NODE_ENV} argument, valid ones: ${Object.keys(availableEnvironments).join(', ')}`));
process.exit(1);
}
var listener = server.listen(serverOptions.bind.port, serverOptions.bind.host, backlog);
const { engines } = require('./package.json');
if (!semver.satisfies(process.versions.node, engines.node)) {
logger.fatal(new Error(`Node version ${process.versions.node} is not supported, please use Node.js ${engines.node}.`));
process.exit(1);
}
var version = require("./package").version;
const server = createServer(serverOptions);
listener.on('listening', function() {
log(
"Windshaft tileserver %s started on %s:%s PID=%d (%s)",
version, serverOptions.bind.host, serverOptions.bind.port, process.pid, ENVIRONMENT
);
// Specify the maximum length of the queue of pending connections for the HTTP server.
// The actual length will be determined by the OS through sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux.
// The default value of this parameter is 511 (not 512).
// See: https://nodejs.org/docs/latest/api/net.html#net_server_listen
const backlog = global.environment.maxConnections || 128;
const listener = server.listen(serverOptions.bind.port, serverOptions.bind.host, backlog);
const { version, name } = require('./package');
listener.on('listening', function () {
const { address, port } = listener.address();
logger.info({ 'Node.js': process.version, pid: process.pid, environment: process.env.NODE_ENV, [name]: version, address, port, config: configurationFile }, `${name} initialized successfully`);
});
setInterval(function() {
function getCPUUsage (oldUsage) {
let usage;
if (oldUsage && oldUsage._start) {
usage = Object.assign({}, process.cpuUsage(oldUsage._start.cpuUsage));
usage.time = Date.now() - oldUsage._start.time;
} else {
usage = Object.assign({}, process.cpuUsage());
usage.time = process.uptime() * 1000; // s to ms
}
usage.percent = (usage.system + usage.user) / (usage.time * 10);
Object.defineProperty(usage, '_start', {
value: {
cpuUsage: process.cpuUsage(),
time: Date.now()
}
});
return usage;
}
let previousCPUUsage = getCPUUsage();
setInterval(function cpuUsageMetrics () {
const CPUUsage = getCPUUsage(previousCPUUsage);
Object.keys(CPUUsage).forEach(property => {
global.statsClient.gauge(`windshaft.cpu.${property}`, CPUUsage[property]);
});
previousCPUUsage = CPUUsage;
}, 5000).unref();
setInterval(function () {
var memoryUsage = process.memoryUsage();
Object.keys(memoryUsage).forEach(function(k) {
Object.keys(memoryUsage).forEach(function (k) {
global.statsClient.gauge('windshaft.memory.' + k, memoryUsage[k]);
});
}, 5000);
}, 5000).unref();
process.on('SIGHUP', function() {
global.log4js.clearAndShutdownAppenders(function() {
global.log4js.configure(log4js_config);
global.logger = global.log4js.getLogger();
log('Log files reloaded');
});
if (global.gc) {
var gcInterval = Number.isFinite(global.environment.gc_interval)
? global.environment.gc_interval
: 10000;
if (gcInterval > 0) {
setInterval(function gcForcedCycle () {
global.gc();
}, gcInterval).unref();
}
}
const gcStats = require('gc-stats')();
gcStats.on('stats', function ({ pauseMS, gctype }) {
global.statsClient.timing('windshaft.gc', pauseMS);
global.statsClient.timing(`windshaft.gctype.${getGCTypeValue(gctype)}`, pauseMS);
});
process.on('uncaughtException', function(err) {
global.logger.error('Uncaught exception: ' + err.stack);
function getGCTypeValue (type) {
// 1: Scavenge (minor GC)
// 2: Mark/Sweep/Compact (major GC)
// 4: Incremental marking
// 8: Weak/Phantom callback processing
// 15: All
let value;
switch (type) {
case 1:
value = 'Scavenge';
break;
case 2:
value = 'MarkSweepCompact';
break;
case 4:
value = 'IncrementalMarking';
break;
case 8:
value = 'ProcessWeakCallbacks';
break;
case 15:
value = 'All';
break;
default:
value = 'Unkown';
break;
}
return value;
}
const exitProcess = logger.finish((err, finalLogger, listener, signal, killTimeout) => {
scheduleForcedExit(killTimeout, finalLogger);
finalLogger.info(`Process has received signal: ${signal}`);
let code = 0;
if (err) {
code = 1;
finalLogger.fatal(err);
}
finalLogger.info(`Process is going to exit with code: ${code}`);
listener.close(() => process.exit(code));
});
function addHandlers (listener, killTimeout) {
process.on('uncaughtException', (err) => exitProcess(err, listener, 'uncaughtException', killTimeout));
process.on('unhandledRejection', (err) => exitProcess(err, listener, 'unhandledRejection', killTimeout));
process.on('ENOMEM', (err) => exitProcess(err, listener, 'ENOMEM', killTimeout));
process.on('SIGINT', () => exitProcess(null, listener, 'SIGINT', killTimeout));
process.on('SIGTERM', () => exitProcess(null, listener, 'SIGTERM', killTimeout));
}
addHandlers(listener, 45000);
function scheduleForcedExit (killTimeout, finalLogger) {
// Schedule exit if there is still ongoing work to deal with
const killTimer = setTimeout(() => {
finalLogger.info('Process didn\'t close on time. Force exit');
process.exit(1);
}, killTimeout);
// Don't keep the process open just for this
killTimer.unref();
}

Binary file not shown.

17
carto-package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "carto_windshaft",
"current_version": {
"requires": {
"node": "^12.16.3",
"npm": "^6.14.4",
"mapnik": "==3.0.15.16",
"crankshaft": "~0.8.1"
},
"works_with": {
"redis": ">=4.0.0",
"postgresql": ">=10.0.0",
"postgis": ">=2.4.4.5",
"carto_postgresql_ext": ">=0.35.0"
}
}
}

View File

@@ -0,0 +1,411 @@
var config = {
environment: process.env.CARTO_WINDSHAFT_NODE_ENV,
port: 8181,
host: null, // null on purpouse so it listens to whatever address docker assigns
// Size of the threadpool which can be used to run user code and get notified in the loop thread
// Its default size is 4, but it can be changed at startup time (the absolute maximum is 128).
// See http://docs.libuv.org/en/latest/threadpool.html
uv_threadpool_size: undefined,
// Time in milliseconds to force GC cycle.
// Disable by using <=0 value.
gc_interval: 10000,
// Regular expression pattern to extract username
// from hostname. Must have a single grabbing block.
user_from_host: process.env.CARTO_WINDSHAFT_USER_FROM_HOST || '^(.*)\\.cartodb\\.com$',
// Base URLs for the APIs
//
// See https://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
//
// Note: each entry corresponds with an express' router.
// You must define at least one path. However, middlewares are optional.
routes: {
api: [{
paths: [
'/api/v1',
'/user/:user/api/v1'
],
// Optional: attach middlewares at the begining of the router
// to perform custom operations.
middlewares: [
function noop () {
return function noopMiddleware (req, res, next) {
next();
};
}
],
// Base url for the Detached Maps API
// "/api/v1/map" is the new API,
map: [{
paths: [
'/map'
],
middlewares: [] // Optional
}],
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
template: [{
paths: [
'/map/named'
],
middlewares: [] // Optional
}]
}]
},
// Resource URLs expose endpoints to request/retrieve metadata associated to Maps: dataviews, analysis node status.
//
// This URLs depend on how `routes` and `user_from_host` are configured: the application can be
// configured to accept request with the {user} in the header host or in the request path.
// It also might depend on the configured cdn_url via `serverMetadata.cdn_url`.
//
// This template allows to make the endpoints generation more flexible, the template exposes the following params:
// 1. {{=it.cdn_url}}: will be used when `serverMetadata.cdn_url` exists.
// 2. {{=it.user}}: will use the username as extraced from `user_from_host` or `routes`.
// 3. {{=it.port}}: will use the `port` from this very same configuration file.
resources_url_templates: {
http: process.env.CARTO_WINDSHAFT_RESOURCE_URL_TEMPLATE_HTTP || 'http://{{=it.cdn_url}}/{{=it.user}}/api/v1/map',
https: process.env.CARTO_WINDSHAFT_RESOURCE_URL_TEMPLATE_HTTPS || 'https://{{=it.cdn_url}}/{{=it.user}}/api/v1/map'
},
// Specify the maximum length of the queue of pending connections for the HTTP server.
// The actual length will be determined by the OS through sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux.
// The default value of this parameter is 511 (not 512).
// See: https://nodejs.org/docs/latest/api/net.html#net_server_listen
maxConnections: 128,
// Maximum number of templates per user. Unlimited by default.
maxUserTemplates: 1024,
// Seconds since "last creation" before a detached
// or template instance map expires. Or: how long do you want
// to be able to navigate the map without a reload ?
// Defaults to 7200 (2 hours)
mapConfigTTL: 7200,
// idle socket timeout, in milliseconds
socket_timeout: 600000,
enable_cors: true,
cache_enabled: true,
// Templated database username for authorized user
// Supported labels: 'user_id' (read from redis)
postgres_auth_user: process.env.CARTO_WINDSHAFT_DB_USER || 'cartodb_user_<%= user_id %>',
// Templated database password for authorized user
// Supported labels: 'user_id', 'user_password' (both read from redis)
postgres_auth_pass: '<%= user_password %>',
postgres: {
user: 'publicuser',
password: 'public',
host: process.env.CARTO_WINDSHAFT_POSTGRES_HOST || 'localhost',
port: process.env.CARTO_WINDSHAFT_POSTGRES_PORT || 5432,
pool: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
},
mapnik_version: undefined,
mapnik_tile_format: 'png8:m=h',
statsd: {
host: process.env.CARTO_WINDSHAFT_STATSD_HOST || 'localhost',
port: 8125,
prefix: process.env.CARTO_WINDSHAFT_STATSD_PREFIX || ':host.', // could be hostname, better not containing dots
cacheDns: true
// support all allowed node-statsd options
},
renderer: {
// Milliseconds since last access before renderer cache item expires
cache_ttl: 60000,
statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status
mvt: {
// If enabled, MVTs will be generated with PostGIS directly
// If disabled, MVTs will be generated with Mapnik MVT
usePostGIS: true
},
mapnik: {
// The size of the pool of internal mapnik backend
// This pool size is per mapnik renderer created in Windshaft's RendererFactory
// See https://github.com/CartoDB/Windshaft/blob/master/lib/windshaft/renderers/renderer_factory.js
// Important: check the configuration of uv_threadpool_size to use suitable value
poolSize: 8,
// The maximum number of waiting clients of the pool of internal mapnik backend
// This maximum number is per mapnik renderer created in Windshaft's RendererFactory
poolMaxWaitingClients: 64,
// Whether grainstore will use a child process or not to transform CartoCSS into Mapnik XML.
// This will prevent blocking the main thread.
useCartocssWorkers: false,
// Metatile is the number of tiles-per-side that are going
// to be rendered at once. If all of them will be requested
// we'd have saved time. If only one will be used, we'd have
// wasted time.
metatile: 2,
// tilelive-mapnik uses an internal cache to store tiles/grids
// generated when using metatile. This options allow to tune
// the behaviour for that internal cache.
metatileCache: {
// Time an object must stay in the cache until is removed
ttl: 0,
// Whether an object must be removed after the first hit
// Usually you want to use `true` here when ttl>0.
deleteOnHit: false
},
// Override metatile behaviour depending on the format
formatMetatile: {
png: 2,
'grid.json': 1
},
// Buffer size is the tickness in pixel of a buffer
// around the rendered (meta?)tile.
//
// This is important for labels and other marker that overlap tile boundaries.
// Setting to 128 ensures no render artifacts.
// 64 may have artifacts but is faster.
// Less important if we can turn metatiling on.
bufferSize: 64,
// SQL queries will be wrapped with ST_SnapToGrid
// Snapping all points of the geometry to a regular grid
snapToGrid: false,
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: true,
postgis: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: 'publicuser',
password: 'public',
host: process.env.CARTO_WINDSHAFT_POSTGRES_HOST || '127.0.0.1',
port: process.env.CARTO_WINDSHAFT_POSTGRES_PORT || 5432,
extent: '-20037508.3,-20037508.3,20037508.3,20037508.3',
// max number of rows to return when querying data, 0 means no limit
row_limit: 65535,
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
max_size: 500,
twkb_encoding: true
},
limits: {
// Time in milliseconds a render request can take before it fails, some notes:
// - 0 means no render limit
// - it considers metatiling, naive implementation: (render timeout) * (number of tiles in metatile)
render: 0,
// As the render request will finish even if timed out, whether it should be placed in the internal
// cache or it should be fully discarded. When placed in the internal cache another attempt to retrieve
// the same tile will result in an immediate response, however that will use a lot of more application
// memory. If we want to enforce this behaviour we have to implement a cache eviction policy for the
// internal cache.
cacheOnTimeout: true
},
// If enabled Mapnik will reuse the features retrieved from the database
// instead of requesting them once per style inside a layer
'cache-features': true,
// Require metrics to the renderer
metrics: false,
// Options for markers attributes, ellipses and images caches
markers_symbolizer_caches: {
disabled: false
}
},
http: {
timeout: 2000, // the timeout in ms for a http tile request
proxy: undefined, // the url for a proxy server
whitelist: [ // the whitelist of urlTemplates that can be used
'.*', // will enable any URL
'http://{s}.example.com/{z}/{x}/{y}.png'
],
// image to use as placeholder when urlTemplate is not in the whitelist
// if provided the http renderer will use it instead of throw an error
fallbackImage: {
type: 'fs', // 'fs' and 'url' supported
src: __dirname + '/../../assets/default-placeholder.png'
}
},
torque: {}
},
// anything analyses related
analysis: {
// batch configuration
batch: {
// Inline execution avoid the use of SQL API as batch endpoint
// When set to true it will run all analysis queries in series, with a direct connection to the DB
// This might be useful for:
// - testing
// - running an standalone server without any dependency on external services
inlineExecution: false,
// where the SQL API is running, it will use a custom Host header to specify the username.
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
},
// Define max execution time in ms for analyses or tags
// If analysis or tag are not found in redis this values will be used as default.
limits: {
moran: { timeout: 120000, maxNumberOfRows: 1e5 },
cpu2x: { timeout: 60000 }
}
},
millstone: {
// Needs to be writable by server user
cache_basedir: process.env.CARTO_WINDSHAFT_TILE_CACHE || '/home/ubuntu/tile_assets/'
},
redis: {
host: process.env.CARTO_WINDSHAFT_REDIS_HOST || '127.0.0.1',
port: process.env.CARTO_WINDSHAFT_REDIS_PORT || 6379,
// Max number of connections in each pool.
// Users will be put on a queue when the limit is hit.
// Set to maxConnection to have no possible queues.
// There are currently 2 pools involved in serving
// windshaft-cartodb requests so multiply this number
// by 2 to know how many possible connections will be
// kept open by the servelsr. The default is 50.
max: 50,
returnToHead: true, // defines the behaviour of the pool: false => queue, true => stack
idleTimeoutMillis: 30000, // idle time before dropping connection
reapIntervalMillis: 1000, // time between cleanups
slowQueries: {
log: true,
elapsedThreshold: 200
},
slowPool: {
log: true, // whether a slow acquire must be logged or not
elapsedThreshold: 25 // the threshold to determine an slow acquire must be reported or not
},
emitter: {
statusInterval: 5000 // time, in ms, between each status report is emitted from the pool, status is sent to statsd
},
unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161
noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading
},
// For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options
httpAgent: {
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 25,
maxFreeSockets: 256
},
varnish: {
host: process.env.CARTO_WINDSHAFT_VARNISH_PORT || 'localhost',
port: process.env.CARTO_WINDSHAFT_VARNISH_PORT || 6082, // the por for the telnet interface where varnish is listening to
http_port: 6081, // the port for the HTTP interface where varnish is listening to
purge_enabled: process.env.CARTO_WINDSHAFT_VARNISH_PURGE_ENABLED === 'true' || false, // whether the purge/invalidation mechanism is enabled in varnish or not
secret: 'xxx',
ttl: 86400,
fallbackTtl: 300,
layergroupTtl: 86400 // the max-age for cache-control header in layergroup responses
},
// this [OPTIONAL] configuration enables invalidating by surrogate key in fastly
fastly: {
// whether the invalidation is enabled or not
enabled: false,
// the fastly api key
apiKey: 'wadus_api_key',
// the service that will get surrogate key invalidation
serviceId: 'wadus_service_id'
},
// If useProfiler is true every response will be served with an
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
useProfiler: false,
serverMetadata: {
cdn_url: {
http: process.env.CARTO_WINDSHAFT_SERVER_CDN_URL_HTTP === 'undefined' ? undefined : process.env.CARTO_WINDSHAFT_SERVER_CDN_URL_HTTP || 'api.cartocdn.com',
https: process.env.CARTO_WINDSHAFT_SERVER_CDN_URL_HTTPS === 'undefined' ? undefined : process.env.CARTO_WINDSHAFT_SERVER_CDN_URL_HTTPS || 'cartocdn.global.ssl.fastly.net'
}
},
// Settings for the health check available at /health
health: {
enabled: process.env.CARTO_WINDSHAFT_HEALTH_ENABLED === 'true' || false,
username: 'localhost',
z: 0,
x: 0,
y: 0
},
disabled_file: 'pids/disabled',
// Use this as a feature flags enabling/disabling mechanism
enabledFeatures: {
// whether it should intercept tile render errors an act based on them, enabled by default.
onTileErrorStrategy: false,
// whether the affected tables for a given SQL must query directly postgresql or use the SQL API
cdbQueryTablesFromPostgres: true,
// whether in mapconfig is available stats & metadata for each layer
layerStats: process.env.CARTO_WINDSHAFT_LAYERSTATS_ENABLED === 'true' || false,
// whether it should rate limit endpoints (global configuration)
rateLimitsEnabled: false,
// whether it should rate limit one or more endpoints (only if rateLimitsEnabled = true)
rateLimitsByEndpoint: {
anonymous: false,
static: false,
static_named: false,
dataview: false,
dataview_search: false,
analysis: false,
analysis_catalog: false,
tile: false,
attributes: false,
named_list: false,
named_create: false,
named_get: false,
named: false,
named_update: false,
named_delete: false,
named_tiles: false
}
},
pubSubMetrics: {
enabled: process.env.CARTO_WINDSHAFT_METRICS_ENABLED === 'true' || false,
project_id: process.env.CARTO_WINDSHAFT_METRICS_PROJECT_ID || 'avid-wavelet-844',
credentials: '',
topic: process.env.CARTO_WINDSHAFT_METRICS_PROJECT_ID || 'raw-metric-events'
}
};
// override some defaults for tests
if (process.env.NODE_ENV === 'test') {
config.user_from_host = '(.*)';
config.postgres_auth_pass = 'test_windshaft_cartodb_user_<%= user_id %>_pass';
config.millstone.cache_basedir = '/tmp/tile_assets';
config.postgres.user = 'test_windshaft_publicuser';
config.resources_url_templates = {
http: 'http://{{=it.user}}.localhost.lan:{{=it.port}}/api/v1/map',
https: 'https://{{=it.user}}.localhost.lan:{{=it.port}}/api/v1/map'
};
config.cache_enabled = false;
config.postgres_auth_user = 'test_windshaft_cartodb_user_<%= user_id %>';
config.renderer.mapnik.postgis.twkb_encoding = false;
config.renderer.mapnik['cache-features'] = false;
config.renderer.http.whitelist = [ // the whitelist of urlTemplates that can be used
'.*', // will enable any URL
'http://{s}.example.com/{z}/{x}/{y}.png',
// for testing purposes
'http://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png'
];
config.analysis.batch.inlineExecution = true;
config.redis.idleTimeoutMillis = 1;
config.redis.reapIntervalMillis = 1;
config.varnish.purge_enabled = false;
config.health.enabled = false;
config.enabledFeatures.layerStats = true;
}
module.exports = config;

View File

@@ -6,25 +6,71 @@ var config = {
// Its default size is 4, but it can be changed at startup time (the absolute maximum is 128).
// See http://docs.libuv.org/en/latest/threadpool.html
,uv_threadpool_size: undefined
// Time in milliseconds to force GC cycle.
// Disable by using <=0 value.
,gc_interval: 10000
// Regular expression pattern to extract username
// from hostname. Must have a single grabbing block.
,user_from_host: '^(.*)\\.localhost'
// Base URLs for the APIs
//
// See http://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
// See https://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
//
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)'
// Base url for the Detached Maps API
// "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)'
// Note: each entry corresponds with an express' router.
// You must define at least one path. However, middlewares are optional.
,routes: {
api: [{
paths: [
'/api/v1',
'/user/:user/api/v1',
],
// Optional: attach middlewares at the begining of the router
// to perform custom operations.
middlewares: [
function noop () {
return function noopMiddleware (req, res, next) {
next();
}
}
],
// Base url for the Detached Maps API
// "/api/v1/map" is the new API,
map: [{
paths: [
'/map',
],
middlewares: [] // Optional
}],
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
template: [{
paths: [
'/map/named'
],
middlewares: [] // Optional
}]
}]
}
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
// Resource URLs expose endpoints to request/retrieve metadata associated to Maps: dataviews, analysis node status.
//
// This URLs depend on how `routes` and `user_from_host` are configured: the application can be
// configured to accept request with the {user} in the header host or in the request path.
// It also might depend on the configured cdn_url via `serverMetadata.cdn_url`.
//
// This template allows to make the endpoints generation more flexible, the template exposes the following params:
// 1. {{=it.cdn_url}}: will be used when `serverMetadata.cdn_url` exists.
// 2. {{=it.user}}: will use the username as extraced from `user_from_host` or `routes`.
// 3. {{=it.port}}: will use the `port` from this very same configuration file.
,resources_url_templates: {
http: 'http://{{=it.user}}.localhost.lan:{{=it.port}}/api/v1/map',
https: 'http://localhost.lan:{{=it.port}}/user/{{=it.user}}/api/v1/map'
}
// Specify the maximum length of the queue of pending connections for the HTTP server.
// The actual length will be determined by the OS through sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux.
// The default value of this parameter is 511 (not 512).
// See: https://nodejs.org/docs/latest/api/net.html#net_server_listen
,maxConnections:128
// Maximum number of templates per user. Unlimited by default.
,maxUserTemplates:1024
@@ -36,12 +82,7 @@ var config = {
// idle socket timeout, in milliseconds
,socket_timeout: 600000
,enable_cors: true
,cache_enabled: false
,log_format: ':req[X-Real-IP] :method :req[Host]:url :status :response-time ms -> :res[Content-Type] (:res[X-Tiler-Profiler])'
// If log_filename is given logs will be written
// there, in append mode. Otherwise stdout is used (default).
// Log file will be re-opened on receiving the HUP signal
,log_filename: undefined
,cache_enabled: true
// Templated database username for authorized user
// Supported labels: 'user_id' (read from redis)
,postgres_auth_user: 'development_cartodb_user_<%= user_id %>'
@@ -49,38 +90,25 @@ var config = {
// Supported labels: 'user_id', 'user_password' (both read from redis)
,postgres_auth_pass: '<%= user_password %>'
,postgres: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
type: "postgis",
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 5432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
/* experimental
geometry_field: "the_geom",
extent: "-180,-90,180,90",
srid: 4326,
*/
row_limit: 65535,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
max_size: 500
pool: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
,mapnik_version: undefined
,mapnik_tile_format: 'png8:m=h'
,statsd: {
host: 'localhost',
port: 8125,
prefix: 'dev.',
prefix: 'dev.', // could be hostname, better not containing dots
cacheDns: true
// support all allowed node-statsd options
}
@@ -88,6 +116,11 @@ var config = {
// Milliseconds since last access before renderer cache item expires
cache_ttl: 60000,
statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status
mvt: {
//If enabled, MVTs will be generated with PostGIS directly
//If disabled, MVTs will be generated with Mapnik MVT
usePostGIS: true
},
mapnik: {
// The size of the pool of internal mapnik backend
// This pool size is per mapnik renderer created in Windshaft's RendererFactory
@@ -95,6 +128,14 @@ var config = {
// Important: check the configuration of uv_threadpool_size to use suitable value
poolSize: 8,
// The maximum number of waiting clients of the pool of internal mapnik backend
// This maximum number is per mapnik renderer created in Windshaft's RendererFactory
poolMaxWaitingClients: 64,
// Whether grainstore will use a child process or not to transform CartoCSS into Mapnik XML.
// This will prevent blocking the main thread.
useCartocssWorkers: false,
// Metatile is the number of tiles-per-side that are going
// to be rendered at once. If all of them will be requested
// we'd have saved time. If only one will be used, we'd have
@@ -134,7 +175,31 @@ var config = {
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
clipByBox2d: true,
postgis: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 5432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
// max number of rows to return when querying data, 0 means no limit
row_limit: 65535,
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
max_size: 500,
twkb_encoding: true
},
limits: {
// Time in milliseconds a render request can take before it fails, some notes:
@@ -149,26 +214,17 @@ var config = {
cacheOnTimeout: true
},
geojson: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
},
// If enabled Mapnik will reuse the features retrieved from the database
// instead of requesting them once per style inside a layer
'cache-features': true,
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
// geometries will be simplified using ST_RemoveRepeatedPoints
// which cost is no more expensive than snapping and results are
// much closer to the original geometry
removeRepeatedPoints: false // this requires postgis >=2.2
// Require metrics to the renderer
metrics: false,
// Options for markers attributes, ellipses and images caches
markers_symbolizer_caches: {
disabled: false
}
},
http: {
timeout: 2000, // the timeout in ms for a http tile request
@@ -184,16 +240,7 @@ var config = {
src: __dirname + '/../../assets/default-placeholder.png'
}
},
torque: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
torque: {}
}
// anything analyses related
,analysis: {
@@ -209,6 +256,12 @@ var config = {
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
},
// Define max execution time in ms for analyses or tags
// If analysis or tag are not found in redis this values will be used as default.
limits: {
moran: { timeout: 120000, maxNumberOfRows: 1e5 },
cpu2x: { timeout: 60000 }
}
}
,millstone: {
@@ -257,6 +310,7 @@ var config = {
purge_enabled: false, // whether the purge/invalidation mechanism is enabled in varnish or not
secret: 'xxx',
ttl: 86400,
fallbackTtl: 300,
layergroupTtl: 86400 // the max-age for cache-control header in layergroup responses
}
// this [OPTIONAL] configuration enables invalidating by surrogate key in fastly
@@ -272,6 +326,12 @@ var config = {
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
,useProfiler:true
,serverMetadata: {
cdn_url: {
http: undefined,
https: undefined
}
}
// Settings for the health check available at /health
,health: {
enabled: false,
@@ -285,12 +345,38 @@ var config = {
// Use this as a feature flags enabling/disabling mechanism
,enabledFeatures: {
// whether it should intercept tile render errors an act based on them, enabled by default.
onTileErrorStrategy: true,
onTileErrorStrategy: false,
// whether the affected tables for a given SQL must query directly postgresql or use the SQL API
cdbQueryTablesFromPostgres: true,
// whether in mapconfig is available stats & metadata for each layer
layerMetadata: true
layerStats: true,
// whether it should rate limit endpoints (global configuration)
rateLimitsEnabled: false,
// whether it should rate limit one or more endpoints (only if rateLimitsEnabled = true)
rateLimitsByEndpoint: {
anonymous: false,
static: false,
static_named: false,
dataview: false,
dataview_search: false,
analysis: false,
analysis_catalog: false,
tile: false,
attributes: false,
named_list: false,
named_create: false,
named_get: false,
named: false,
named_update: false,
named_delete: false,
named_tiles: false
}
}
,pubSubMetrics: {
enabled: false,
project_id: '',
credentials: '',
topic: ''
}
};

View File

@@ -6,25 +6,71 @@ var config = {
// Its default size is 4, but it can be changed at startup time (the absolute maximum is 128).
// See http://docs.libuv.org/en/latest/threadpool.html
,uv_threadpool_size: undefined
// Time in milliseconds to force GC cycle.
// Disable by using <=0 value.
,gc_interval: 10000
// Regular expression pattern to extract username
// from hostname. Must have a single grabbing block.
,user_from_host: '^(.*)\\.cartodb\\.com$'
// Base URLs for the APIs
//
// See http://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
// See https://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
//
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)'
// Base url for the Detached Maps API
// "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)'
// Note: each entry corresponds with an express' router.
// You must define at least one path. However, middlewares are optional.
,routes: {
api: [{
paths: [
'/api/v1',
'/user/:user/api/v1',
],
// Optional: attach middlewares at the begining of the router
// to perform custom operations.
middlewares: [
function noop () {
return function noopMiddleware (req, res, next) {
next();
}
}
],
// Base url for the Detached Maps API
// "/api/v1/map" is the new API,
map: [{
paths: [
'/map',
],
middlewares: [] // Optional
}],
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
template: [{
paths: [
'/map/named'
],
middlewares: [] // Optional
}]
}]
}
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
// Resource URLs expose endpoints to request/retrieve metadata associated to Maps: dataviews, analysis node status.
//
// This URLs depend on how `routes` and `user_from_host` are configured: the application can be
// configured to accept request with the {user} in the header host or in the request path.
// It also might depend on the configured cdn_url via `serverMetadata.cdn_url`.
//
// This template allows to make the endpoints generation more flexible, the template exposes the following params:
// 1. {{=it.cdn_url}}: will be used when `serverMetadata.cdn_url` exists.
// 2. {{=it.user}}: will use the username as extraced from `user_from_host` or `routes`.
// 3. {{=it.port}}: will use the `port` from this very same configuration file.
,resources_url_templates: {
http: 'http://{{=it.cdn_url}}/{{=it.user}}/api/v1/map',
https: 'https://{{=it.cdn_url}}/{{=it.user}}/api/v1/map'
}
// Specify the maximum length of the queue of pending connections for the HTTP server.
// The actual length will be determined by the OS through sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux.
// The default value of this parameter is 511 (not 512).
// See: https://nodejs.org/docs/latest/api/net.html#net_server_listen
,maxConnections:128
// Maximum number of templates per user. Unlimited by default.
,maxUserTemplates:1024
@@ -37,11 +83,6 @@ var config = {
,socket_timeout: 600000
,enable_cors: true
,cache_enabled: true
,log_format: ':req[X-Real-IP] :method :req[Host]:url :status :response-time ms -> :res[Content-Type] (:res[X-Tiler-Profiler])'
// If log_filename is given logs will be written
// there, in append mode. Otherwise stdout is used (default).
// Log file will be re-opened on receiving the HUP signal
,log_filename: 'logs/node-windshaft.log'
// Templated database username for authorized user
// Supported labels: 'user_id' (read from redis)
,postgres_auth_user: 'cartodb_user_<%= user_id %>'
@@ -49,25 +90,18 @@ var config = {
// Supported labels: 'user_id', 'user_password' (both read from redis)
,postgres_auth_pass: '<%= user_password %>'
,postgres: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 6432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
row_limit: 65535,
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
max_size: 500
port: 5432,
pool: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
,mapnik_version: undefined
,mapnik_tile_format: 'png8:m=h'
@@ -82,6 +116,11 @@ var config = {
// Milliseconds since last access before renderer cache item expires
cache_ttl: 60000,
statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status
mvt: {
//If enabled, MVTs will be generated with PostGIS directly
//If disabled, MVTs will be generated with Mapnik MVT
usePostGIS: true
},
mapnik: {
// The size of the pool of internal mapnik backend
// This pool size is per mapnik renderer created in Windshaft's RendererFactory
@@ -89,6 +128,14 @@ var config = {
// Important: check the configuration of uv_threadpool_size to use suitable value
poolSize: 8,
// The maximum number of waiting clients of the pool of internal mapnik backend
// This maximum number is per mapnik renderer created in Windshaft's RendererFactory
poolMaxWaitingClients: 64,
// Whether grainstore will use a child process or not to transform CartoCSS into Mapnik XML.
// This will prevent blocking the main thread.
useCartocssWorkers: false,
// Metatile is the number of tiles-per-side that are going
// to be rendered at once. If all of them will be requested
// we'd have saved time. If only one will be used, we'd have
@@ -128,7 +175,31 @@ var config = {
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
clipByBox2d: true,
postgis: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 5432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
// max number of rows to return when querying data, 0 means no limit
row_limit: 65535,
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
max_size: 500,
twkb_encoding: true
},
limits: {
// Time in milliseconds a render request can take before it fails, some notes:
@@ -143,26 +214,17 @@ var config = {
cacheOnTimeout: true
},
geojson: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
},
// If enabled Mapnik will reuse the features retrieved from the database
// instead of requesting them once per style inside a layer
'cache-features': true,
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
// geometries will be simplified using ST_RemoveRepeatedPoints
// which cost is no more expensive than snapping and results are
// much closer to the original geometry
removeRepeatedPoints: false // this requires postgis >=2.2
// Require metrics to the renderer
metrics: false,
// Options for markers attributes, ellipses and images caches
markers_symbolizer_caches: {
disabled: false
}
},
http: {
timeout: 2000, // the timeout in ms for a http tile request
@@ -178,16 +240,7 @@ var config = {
src: __dirname + '/../../assets/default-placeholder.png'
}
},
torque: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
torque: {}
}
// anything analyses related
,analysis: {
@@ -203,6 +256,12 @@ var config = {
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
},
// Define max execution time in ms for analyses or tags
// If analysis or tag are not found in redis this values will be used as default.
limits: {
moran: { timeout: 120000, maxNumberOfRows: 1e5 },
cpu2x: { timeout: 60000 }
}
}
,millstone: {
@@ -251,6 +310,7 @@ var config = {
purge_enabled: false, // whether the purge/invalidation mechanism is enabled in varnish or not
secret: 'xxx',
ttl: 86400,
fallbackTtl: 300,
layergroupTtl: 86400 // the max-age for cache-control header in layergroup responses
}
// this [OPTIONAL] configuration enables invalidating by surrogate key in fastly
@@ -285,11 +345,38 @@ var config = {
// Use this as a feature flags enabling/disabling mechanism
,enabledFeatures: {
// whether it should intercept tile render errors an act based on them, enabled by default.
onTileErrorStrategy: true,
onTileErrorStrategy: false,
// whether the affected tables for a given SQL must query directly postgresql or use the SQL API
cdbQueryTablesFromPostgres: true,
// whether in mapconfig is available stats & metadata for each layer
layerMetadata: false
layerStats: false,
// whether it should rate limit endpoints (global configuration)
rateLimitsEnabled: false,
// whether it should rate limit one or more endpoints (only if rateLimitsEnabled = true)
rateLimitsByEndpoint: {
anonymous: false,
static: false,
static_named: false,
dataview: false,
dataview_search: false,
analysis: false,
analysis_catalog: false,
tile: false,
attributes: false,
named_list: false,
named_create: false,
named_get: false,
named: false,
named_update: false,
named_delete: false,
named_tiles: false
}
}
,pubSubMetrics: {
enabled: true,
project_id: 'avid-wavelet-844',
credentials: '',
topic: 'raw-metric-events'
}
};

View File

@@ -6,25 +6,70 @@ var config = {
// Its default size is 4, but it can be changed at startup time (the absolute maximum is 128).
// See http://docs.libuv.org/en/latest/threadpool.html
,uv_threadpool_size: undefined
// Time in milliseconds to force GC cycle.
// Disable by using <=0 value.
,gc_interval: 10000
// Regular expression pattern to extract username
// from hostname. Must have a single grabbing block.
,user_from_host: '^(.*)\\.cartodb\\.com$'
// Base URLs for the APIs
//
// See http://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
// See https://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
//
// Base url for the Templated Maps API
// "/api/v1/maps/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)'
// Base url for the Detached Maps API
// "/api/v1/maps" is the the new API,
// "/tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)'
// Note: each entry corresponds with an express' router.
// You must define at least one path. However, middlewares are optional.
,routes: {
api: [{
paths: [
'/api/v1',
'/user/:user/api/v1',
],
// Optional: attach middlewares at the begining of the router
// to perform custom operations.
middlewares: [
function noop () {
return function noopMiddleware (req, res, next) {
next();
}
}
],
// Base url for the Detached Maps API
// "/api/v1/map" is the new API,
map: [{
paths: [
'/map',
],
middlewares: [] // Optional
}],
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
template: [{
paths: [
'/map/named'
],
middlewares: [] // Optional
}]
}]
}
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
// Resource URLs expose endpoints to request/retrieve metadata associated to Maps: dataviews, analysis node status.
//
// This URLs depend on how `routes` and `user_from_host` are configured: the application can be
// configured to accept request with the {user} in the header host or in the request path.
// It also might depend on the configured cdn_url via `serverMetadata.cdn_url`.
//
// This template allows to make the endpoints generation more flexible, the template exposes the following params:
// 1. {{=it.cdn_url}}: will be used when `serverMetadata.cdn_url` exists.
// 2. {{=it.user}}: will use the username as extraced from `user_from_host` or `routes`.
// 3. {{=it.port}}: will use the `port` from this very same configuration file.
,resources_url_templates: {
http: 'http://{{=it.cdn_url}}/{{=it.user}}/api/v1/map',
https: 'https://{{=it.cdn_url}}/{{=it.user}}/api/v1/map'
}
// Specify the maximum length of the queue of pending connections for the HTTP server.
// The actual length will be determined by the OS through sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux.
// The default value of this parameter is 511 (not 512).
,maxConnections:128
// Maximum number of templates per user. Unlimited by default.
,maxUserTemplates:1024
@@ -37,11 +82,6 @@ var config = {
,socket_timeout: 600000
,enable_cors: true
,cache_enabled: true
,log_format: ':req[X-Real-IP] :method :req[Host]:url :status :response-time ms (:res[X-Tiler-Profiler]) -> :res[Content-Type]'
// If log_filename is given logs will be written
// there, in append mode. Otherwise stdout is used (default).
// Log file will be re-opened on receiving the HUP signal
,log_filename: 'logs/node-windshaft.log'
// Templated database username for authorized user
// Supported labels: 'user_id' (read from redis)
,postgres_auth_user: 'cartodb_staging_user_<%= user_id %>'
@@ -49,32 +89,25 @@ var config = {
// Supported labels: 'user_id', 'user_password' (both read from redis)
,postgres_auth_pass: '<%= user_password %>'
,postgres: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 6432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
row_limit: 65535,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
max_size: 500
port: 5432,
pool: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
,mapnik_version: undefined
,mapnik_tile_format: 'png8:m=h'
,statsd: {
host: 'localhost',
port: 8125,
prefix: 'stage.:host.',
prefix: 'stage.:host.', // could be hostname, better not containing dots
cacheDns: true
// support all allowed node-statsd options
}
@@ -82,6 +115,11 @@ var config = {
// Milliseconds since last access before renderer cache item expires
cache_ttl: 60000,
statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status
mvt: {
//If enabled, MVTs will be generated with PostGIS directly
//If disabled, MVTs will be generated with Mapnik MVT
usePostGIS: true
},
mapnik: {
// The size of the pool of internal mapnik backend
// This pool size is per mapnik renderer created in Windshaft's RendererFactory
@@ -89,6 +127,14 @@ var config = {
// Important: check the configuration of uv_threadpool_size to use suitable value
poolSize: 8,
// The maximum number of waiting clients of the pool of internal mapnik backend
// This maximum number is per mapnik renderer created in Windshaft's RendererFactory
poolMaxWaitingClients: 64,
// Whether grainstore will use a child process or not to transform CartoCSS into Mapnik XML.
// This will prevent blocking the main thread.
useCartocssWorkers: false,
// Metatile is the number of tiles-per-side that are going
// to be rendered at once. If all of them will be requested
// we'd have saved time. If only one will be used, we'd have
@@ -128,7 +174,31 @@ var config = {
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
clipByBox2d: true,
postgis: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 5432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
// max number of rows to return when querying data, 0 means no limit
row_limit: 65535,
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
max_size: 500,
twkb_encoding: true
},
limits: {
// Time in milliseconds a render request can take before it fails, some notes:
@@ -143,26 +213,17 @@ var config = {
cacheOnTimeout: true
},
geojson: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
},
// If enabled Mapnik will reuse the features retrieved from the database
// instead of requesting them once per style inside a layer
'cache-features': true,
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
// geometries will be simplified using ST_RemoveRepeatedPoints
// which cost is no more expensive than snapping and results are
// much closer to the original geometry
removeRepeatedPoints: false // this requires postgis >=2.2
// Require metrics to the renderer
metrics: false,
// Options for markers attributes, ellipses and images caches
markers_symbolizer_caches: {
disabled: false
}
},
http: {
timeout: 2000, // the timeout in ms for a http tile request
@@ -178,16 +239,7 @@ var config = {
src: __dirname + '/../../assets/default-placeholder.png'
}
},
torque: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
torque: {}
}
// anything analyses related
,analysis: {
@@ -203,6 +255,12 @@ var config = {
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
},
// Define max execution time in ms for analyses or tags
// If analysis or tag are not found in redis this values will be used as default.
limits: {
moran: { timeout: 120000, maxNumberOfRows: 1e5 },
cpu2x: { timeout: 60000 }
}
}
,millstone: {
@@ -251,6 +309,7 @@ var config = {
purge_enabled: false, // whether the purge/invalidation mechanism is enabled in varnish or not
secret: 'xxx',
ttl: 86400,
fallbackTtl: 300,
layergroupTtl: 86400 // the max-age for cache-control header in layergroup responses
}
// this [OPTIONAL] configuration enables invalidating by surrogate key in fastly
@@ -274,7 +333,7 @@ var config = {
}
// Settings for the health check available at /health
,health: {
enabled: false,
enabled: true,
username: 'localhost',
z: 0,
x: 0,
@@ -285,11 +344,38 @@ var config = {
// Use this as a feature flags enabling/disabling mechanism
,enabledFeatures: {
// whether it should intercept tile render errors an act based on them, enabled by default.
onTileErrorStrategy: true,
onTileErrorStrategy: false,
// whether the affected tables for a given SQL must query directly postgresql or use the SQL API
cdbQueryTablesFromPostgres: true,
// whether in mapconfig is available stats & metadata for each layer
layerMetadata: true
layerStats: true,
// whether it should rate limit endpoints (global configuration)
rateLimitsEnabled: false,
// whether it should rate limit one or more endpoints (only if rateLimitsEnabled = true)
rateLimitsByEndpoint: {
anonymous: false,
static: false,
static_named: false,
dataview: false,
dataview_search: false,
analysis: false,
analysis_catalog: false,
tile: false,
attributes: false,
named_list: false,
named_create: false,
named_get: false,
named: false,
named_update: false,
named_delete: false,
named_tiles: false
}
}
,pubSubMetrics: {
enabled: true,
project_id: '',
credentials: '',
topic: 'raw-metric-events'
}
};

View File

@@ -6,6 +6,9 @@ var config = {
// Its default size is 4, but it can be changed at startup time (the absolute maximum is 128).
// See http://docs.libuv.org/en/latest/threadpool.html
,uv_threadpool_size: undefined
// Time in milliseconds to force GC cycle.
// Disable by using <=0 value.
,gc_interval: 10000
// Regular expression pattern to extract username
// from hostname. Must have a single grabbing block.
,user_from_host: '(.*)'
@@ -14,17 +17,60 @@ var config = {
//
// See https://github.com/CartoDB/Windshaft-cartodb/wiki/Unified-Map-API
//
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
// "/tiles/template" is for compatibility with versions up to 1.6.x
,base_url_templated: '(?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)'
// Base url for the Detached Maps API
// "maps" is the the new API,
// "tiles/layergroup" is for compatibility with versions up to 1.6.x
,base_url_detached: '(?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)'
// Note: each entry corresponds with an express' router.
// You must define at least one path. However, middlewares are optional.
,routes: {
api: [{
paths: [
'/api/v1',
'/user/:user/api/v1',
],
// Optional: attach middlewares at the begining of the router
// to perform custom operations.
middlewares: [
function noop () {
return function noopMiddleware (req, res, next) {
next();
}
}
],
// Base url for the Detached Maps API
// "/api/v1/map" is the new API,
map: [{
paths: [
'/map',
],
middlewares: [] // Optional
}],
// Base url for the Templated Maps API
// "/api/v1/map/named" is the new API,
template: [{
paths: [
'/map/named'
],
middlewares: [] // Optional
}]
}]
}
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
// Resource URLs expose endpoints to request/retrieve metadata associated to Maps: dataviews, analysis node status.
//
// This URLs depend on how `routes` and `user_from_host` are configured: the application can be
// configured to accept request with the {user} in the header host or in the request path.
// It also might depend on the configured cdn_url via `serverMetadata.cdn_url`.
//
// This template allows to make the endpoints generation more flexible, the template exposes the following params:
// 1. {{=it.cdn_url}}: will be used when `serverMetadata.cdn_url` exists.
// 2. {{=it.user}}: will use the username as extraced from `user_from_host` or `routes`.
// 3. {{=it.port}}: will use the `port` from this very same configuration file.
,resources_url_templates: {
http: 'http://{{=it.user}}.localhost.lan:{{=it.port}}/api/v1/map',
https: 'https://{{=it.user}}.localhost.lan:{{=it.port}}/api/v1/map'
}
// Specify the maximum length of the queue of pending connections for the HTTP server.
// The actual length will be determined by the OS through sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux.
// The default value of this parameter is 511 (not 512).
// See: https://nodejs.org/docs/latest/api/net.html#net_server_listen
,maxConnections:128
// Maximum number of templates per user. Unlimited by default.
,maxUserTemplates:1024
@@ -37,11 +83,6 @@ var config = {
,socket_timeout: 600000
,enable_cors: true
,cache_enabled: false
,log_format: '[:date] :req[X-Real-IP] :method :req[Host]:url :status :response-time ms -> :res[Content-Type] (:res[X-Tiler-Profiler])'
// If log_filename is given logs will be written
// there, in append mode. Otherwise stdout is used (default).
// Log file will be re-opened on receiving the HUP signal
//,log_filename: 'logs/node-windshaft.log'
// Templated database username for authorized user
// Supported labels: 'user_id' (read from redis)
,postgres_auth_user: 'test_windshaft_cartodb_user_<%= user_id %>'
@@ -49,32 +90,25 @@ var config = {
// Supported labels: 'user_id', 'user_password' (both read from redis)
,postgres_auth_pass: 'test_windshaft_cartodb_user_<%= user_id %>_pass'
,postgres: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "test_windshaft_publicuser",
password: "public",
host: '127.0.0.1',
port: 5432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
row_limit: 65535,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
max_size: 500
pool: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
,mapnik_version: ''
,mapnik_version: undefined
,mapnik_tile_format: 'png8:m=h'
,statsd: {
host: 'localhost',
port: 8125,
prefix: 'test.:host.',
prefix: 'test.:host.', // could be hostname, better not containing dots
cacheDns: true
// support all allowed node-statsd options
}
@@ -82,6 +116,11 @@ var config = {
// Milliseconds since last access before renderer cache item expires
cache_ttl: 60000,
statsInterval: 5000, // milliseconds between each report to statsd about number of renderers and mapnik pool status
mvt: {
//If enabled, MVTs will be generated with PostGIS directly
//If disabled, MVTs will be generated with Mapnik MVT
usePostGIS: true
},
mapnik: {
// The size of the pool of internal mapnik backend
// This pool size is per mapnik renderer created in Windshaft's RendererFactory
@@ -89,6 +128,14 @@ var config = {
// Important: check the configuration of uv_threadpool_size to use suitable value
poolSize: 8,
// The maximum number of waiting clients of the pool of internal mapnik backend
// This maximum number is per mapnik renderer created in Windshaft's RendererFactory
poolMaxWaitingClients: 64,
// Whether grainstore will use a child process or not to transform CartoCSS into Mapnik XML.
// This will prevent blocking the main thread.
useCartocssWorkers: false,
// Metatile is the number of tiles-per-side that are going
// to be rendered at once. If all of them will be requested
// we'd have saved time. If only one will be used, we'd have
@@ -128,7 +175,31 @@ var config = {
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
clipByBox2d: true,
postgis: {
// Parameters to pass to datasource plugin of mapnik
// See http://github.com/mapnik/mapnik/wiki/PostGIS
user: "publicuser",
password: "public",
host: '127.0.0.1',
port: 5432,
extent: "-20037508.3,-20037508.3,20037508.3,20037508.3",
// max number of rows to return when querying data, 0 means no limit
row_limit: 65535,
/*
* Set persist_connection to false if you want
* database connections to be closed on renderer
* expiration (1 minute after last use).
* Setting to true (the default) would never
* close any connection for the server's lifetime
*/
persist_connection: false,
simplify_geometries: true,
use_overviews: true, // use overviews to retrieve raster
max_size: 500,
twkb_encoding: false
},
limits: {
// Time in milliseconds a render request can take before it fails, some notes:
@@ -143,24 +214,16 @@ var config = {
cacheOnTimeout: true
},
geojson: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
},
// If enabled Mapnik will reuse the features retrieved from the database
// instead of requesting them once per style inside a layer
'cache-features': false,
// SQL queries will be wrapped with ST_ClipByBox2D
// Returning the portion of a geometry falling within a rectangle
// It will only work if snapToGrid is enabled
clipByBox2d: false, // this requires postgis >=2.2 and geos >=3.5
// geometries will be simplified using ST_RemoveRepeatedPoints
// which cost is no more expensive than snapping and results are
// much closer to the original geometry
removeRepeatedPoints: false // this requires postgis >=2.2
// Require metrics to the renderer
metrics: false,
// Options for markers attributes, ellipses and images caches
markers_symbolizer_caches: {
disabled: false
}
},
http: {
@@ -179,16 +242,7 @@ var config = {
src: __dirname + '/../../assets/default-placeholder.png'
}
},
torque: {
dbPoolParams: {
// maximum number of resources to create at any given time
size: 16,
// max milliseconds a resource can go unused before it should be destroyed
idleTimeout: 3000,
// frequency to check for idle resources
reapInterval: 1000
}
}
torque: {}
}
// anything analyses related
,analysis: {
@@ -204,6 +258,12 @@ var config = {
endpoint: 'http://127.0.0.1:8080/api/v2/sql/job',
// the template to use for adding the host header in the batch api requests
hostHeaderTemplate: '{{=it.username}}.localhost.lan'
},
// Define max execution time in ms for analyses or tags
// If analysis or tag are not found in redis this values will be used as default.
limits: {
moran: { timeout: 120000, maxNumberOfRows: 1e5 },
cpu2x: { timeout: 60000 }
}
}
,millstone: {
@@ -252,6 +312,7 @@ var config = {
purge_enabled: false, // whether the purge/invalidation mechanism is enabled in varnish or not
secret: 'xxx',
ttl: 86400,
fallbackTtl: 300,
layergroupTtl: 86400 // the max-age for cache-control header in layergroup responses
}
// this [OPTIONAL] configuration enables invalidating by surrogate key in fastly
@@ -267,6 +328,12 @@ var config = {
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
,useProfiler:true
,serverMetadata: {
cdn_url: {
http: undefined,
https: undefined
}
}
// Settings for the health check available at /health
,health: {
enabled: false,
@@ -280,11 +347,38 @@ var config = {
// Use this as a feature flags enabling/disabling mechanism
,enabledFeatures: {
// whether it should intercept tile render errors an act based on them, enabled by default.
onTileErrorStrategy: true,
onTileErrorStrategy: false,
// whether the affected tables for a given SQL must query directly postgresql or use the SQL API
cdbQueryTablesFromPostgres: true,
// whether in mapconfig is available stats & metadata for each layer
layerMetadata: true
layerStats: true,
// whether it should rate limit endpoints (global configuration)
rateLimitsEnabled: false,
// whether it should rate limit one or more endpoints (only if rateLimitsEnabled = true)
rateLimitsByEndpoint: {
anonymous: false,
static: false,
static_named: false,
dataview: false,
dataview_search: false,
analysis: false,
analysis_catalog: false,
tile: false,
attributes: false,
named_list: false,
named_create: false,
named_get: false,
named: false,
named_update: false,
named_delete: false,
named_tiles: false
}
}
,pubSubMetrics: {
enabled: false,
project_id: '',
credentials: '',
topic: ''
}
};

81
configure vendored
View File

@@ -1,81 +0,0 @@
#!/bin/sh
#
# This script creates config/environments/*.js files using
# config/environments/*.js.example files as input and performing
# settings substitutions.
#
# It relies on a known format of the .js.example files which haven't
# been made easier to parse to still let humans copy them manually and
# do further editing or leave them as such to get the same setup as before
# the introduction of this script.
#
# The script is a work in progress. Available switches are printed
# by invoking with the --help switch. More switches will be added
# as the need/request for them arises.
#
# --strk(2012-07-23)
#
ENVDIR=config/environments
PGPORT=
MAPNIK_VERSION=
ENVIRONMENT=development
STATUS="$0 $*"
usage() {
echo "Usage: $0 [OPTION]"
echo
echo "Configuration:"
echo " --help display this help and exit"
echo " --with-pgport=NUM access PostgreSQL server on TCP port NUM [$PGPORT]"
echo " --with-mapnik-version=STRING set mapnik version string [$MAPNIK_VERSION]"
echo " --environment=STRING set output environment name [$ENVIRONMENT]"
}
while test -n "$1"; do
case "$1" in
--help|-h)
usage
exit 0
;;
--with-pgport=*)
PGPORT=`echo "$1" | cut -d= -f2`
;;
--with-mapnik-version=*)
MAPNIK_VERSION=`echo "$1" | cut -d= -f2`
;;
--environment=*)
ENVIRONMENT=`echo "$1" | cut -d= -f2`
;;
*)
echo "Unused option '$1'" >&2
;;
esac
shift
done
ENVEX=./${ENVDIR}/${ENVIRONMENT}.js.example
if [ -z "$PGPORT" ]; then
PGPORT=`node -e "console.log(require('${ENVEX}').postgres.port)"`
fi
echo "PGPORT: $PGPORT"
echo "MAPNIK_VERSION: $MAPNIK_VERSION"
echo "ENVIRONMENT: $ENVIRONMENT"
o=`dirname "${ENVEX}"`/`basename "${ENVEX}" .example`
echo "Writing $o"
# See http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/
sed -n "1h;1!H;\${;g;s/\(,postgres: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$PGPORT\2/;p;}" < "${ENVEX}" \
| sed "s/mapnik_version:.*/mapnik_version: '$MAPNIK_VERSION'/" \
> "$o"
STATUSFILE=config.status--${ENVIRONMENT}
echo "Writing ${STATUSFILE}"
echo ${STATUS} > ${STATUSFILE} && chmod +x ${STATUSFILE}

View File

@@ -1,19 +0,0 @@
# Maps API
The CARTO Maps API allows you to generate maps based on data hosted in your CARTO account and apply custom SQL and CartoCSS to the data. The API generates a XYZ-based URL to fetch Web Mercator projected tiles, using web clients such as [Leaflet](http://leafletjs.com), [Google Maps](https://developers.google.com/maps/), or [OpenLayers](http://openlayers.org/).
You can create two types of maps with the Maps API:
- **Anonymous Maps**
You can create maps using your CARTO public data. Any client can change the read-only SQL and CartoCSS parameters that generate the map tiles. These maps can be created from a JavaScript application alone and no authenticated calls are needed. See [this CARTO.js example](/carto-engine/carto-js/getting-started/).
- **Named Maps**
There are also maps that have access to your private data. These maps require an owner to setup and modify any SQL and CartoCSS parameters and are not modifiable without new setup calls.
## Documentation
* [Quickstart](quickstart.md)
* [General Concepts](general_concepts.md)
* [Anonymous Maps](anonymous_maps.md)
* [Named Maps](named_maps.md)
* [Static Maps API](static_maps_api.md)

View File

@@ -1,114 +0,0 @@
This document list all routes available in Windshaft-cartodb Maps API server.
## Routes list
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/:token/:z/:x/:y@:scale_factor?x.:format {:user(f),:token(f),:z(f),:x(f),:y(f),:scale_factor(t),:format(f)} (1)`
<br/>Notes: Mapnik retina tiles [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/:token/:z/:x/:y.:format {:user(f),:token(f),:z(f),:x(f),:y(f),:format(f)} (1)`
<br/>Notes: Mapnik tiles [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/:token/:layer/:z/:x/:y.(:format) {:user(f),:token(f),:layer(f),:z(f),:x(f),:y(f),:format(f)} (1)`
<br/>Notes: Per :layer rendering based on :format [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/:token/:layer/attributes/:fid {:user(f),:token(f),:layer(f),:fid(f)} (1)`
<br/>Notes: Endpoint for info windows data, alternative for sql api when tables are private [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/static/center/:token/:z/:lat/:lng/:width/:height.:format {:user(f),:token(f),:z(f),:lat(f),:lng(f),:width(f),:height(f),:format(f)} (1)`
<br/>Notes: Static Maps API [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/static/bbox/:token/:west,:south,:east,:north/:width/:height.:format {:user(f),:token(f),:west(f),:south(f),:east(f),:north(f),:width(f),:height(f),:format(f)} (1)`
<br/>Notes: Static Maps API [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/:token/:layer/widget/:widgetName {:user(f),:token(f),:layer(f),:widgetName(f)} (1)`
<br/>Notes: By :widgetName per :layer widget [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/:token/:layer/widget/:widgetName/search {:user(f),:token(f),:layer(f),:widgetName(f)} (1)`
<br/>Notes: By :widgetName per :layer widget search [0]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup) {:user(f)} (1)`
<br/>Notes: Map instantiation [0]
1. `POST (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup) {:user(f)} (1)`
<br/>Notes: Map instantiation [0]
1. `GET (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id/jsonp {:user(f),:template_id(f)} (1)`
<br/>Notes: Named maps JSONP instantiation [1]
1. `POST (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id {:user(f),:template_id(f)} (1)`
<br/>Notes: Instantiate named map [1]
1. `OPTIONS (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup) {:user(f)} (1)`
<br/>Notes: CORS [0]
1. `GET (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id/:layer/:z/:x/:y.(:format) {:user(f),:template_id(f),:layer(f),:z(f),:x(f),:y(f),:0(f),:format(f)} (1)`
<br/>Notes: Per :layer fixed URL named map tiles [1]
1. `GET (?:/api/v1/map|/user/:user/api/v1/map|/tiles/layergroup)/static/named/:template_id/:width/:height.:format {:user(f),:template_id(f),:width(f),:height(f),:format(f)} (1)`
<br/>Notes: Static map for named maps [1]
1. `POST (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template) {:user(f)} (1)`
<br/>Notes: Create named map (w/ API KEY) [1]
1. `PUT (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id {:user(f),:template_id(f)} (1)`
<br/>Notes: Update a named map (w/ API KEY) [1]
1. `GET (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id {:user(f),:template_id(f)} (1)`
<br/>Notes: Named map retrieval (w/ API KEY) [1]
1. `DELETE (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id {:user(f),:template_id(f)} (1)`
<br/>Notes: Delete named map (w/ API KEY) [1]
1. `GET (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template) {:user(f)} (1)`
<br/>Notes: List named maps (w/ API KEY) [1]
1. `OPTIONS (?:/api/v1/map/named|/user/:user/api/v1/map/named|/tiles/template)/:template_id {:user(f),:template_id(f)} (1)`
<br/>Notes: CORS [1]
1. `GET /health {} (1)`
<br/>Notes: Health check
1. `GET / {} (1)`
<br/>Notes: Welcome message
1. `GET /version {} (1)`
<br/>Notes: Return relevant module versions: mapnik, grainstore, etc
## Optional deprecated routes
- [0] `/tiles/layergroup` is deprecated and `/api/v1/map` should be used but we keep it for now.
- [1] `/tiles/template` is deprecated and `/api/v1/map/named` should be used but we keep it for now.
## How to generate the list of routes
Something like the following patch should do the trick
```javascript
diff --git a/lib/cartodb/server.js b/lib/cartodb/server.js
index 5f62850..bca377d 100644
--- a/lib/cartodb/server.js
+++ b/lib/cartodb/server.js
@@ -215,6 +215,20 @@ module.exports = function(serverOptions) {
* END Routing
******************************************************************************************************************/
+ var format = require('util').format;
+ var routesNotes = app._router.stack
+ .filter(function(handler) { return !!handler.route; })
+ .map(function(handler) {
+ return format("\n1. `%s %s {%s} (1)`\n<br/>Notes: [DEPRECATED]? ",
+ Object.keys(handler.route.methods)[0].toUpperCase(),
+ handler.route.path,
+ handler.keys.map(function(k) {
+ return format(':%s(%s)', k.name, k.optional ? 't' : 'f');
+ }).join(',')
+ );
+ });
+ console.log(routesNotes.join('\n'));
+
return app;
};
```

View File

@@ -1,194 +0,0 @@
# Anonymous Maps
Anonymous Maps allows you to instantiate a map given SQL and CartoCSS. It also allows you to add interaction capabilities using [UTF Grid.](https://github.com/mapbox/utfgrid-spec)
## Instantiate
#### Definition
```html
POST /api/v1/map
```
#### Params
```javascript
{
"version": "1.3.0",
"layers": [{
"type": "mapnik",
"options": {
"cartocss_version": "2.1.1",
"cartocss": "#layer { polygon-fill: #FFF; }",
"sql": "select * from european_countries_e",
"interactivity": ["cartodb_id", "iso3"]
}
}]
}
```
See [MapConfig File Formats](http://docs.carto.com/carto-engine/maps-api/mapconfig/) for details.
#### Response
The response includes:
Attributes | Description
--- | ---
layergroupid | The ID for that map, used to compose the URL for the tiles. The final URL is: `https://{username}.carto.com/api/v1/map/{layergroupid}/{z}/{x}/{y}.png`
updated_at | The ISO date of the last time the data involved in the query was updated.
metadata | Includes information about the layers.
cdn_url | URLs to fetch the data using the best CDN for your zone.
### Example
#### Call
```bash
curl 'https://{username}.carto.com/api/v1/map' -H 'Content-Type: application/json' -d @mapconfig.json
```
#### Response
```javascript
{
"layergroupid": "c01a54877c62831bb51720263f91fb33:0",
"last_updated": "1970-01-01T00:00:00.000Z",
"metadata": {
"layers": [
{
"type": "mapnik",
"meta": {}
}
]
},
"cdn_url": {
"http": "http://cdb.com",
"https": "https://cdb.com"
}
}
```
### Retrieve resources from the layergroup
When you have a layergroup, there are several resources for retrieving layergoup details such as, accessing Mapnik tiles, getting individual layers, accessing defined Attributes, and blending and layer selection.
#### Mapnik tiles
These tiles will get just the Mapnik layers. To get individual layers, see the following section.
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{z}/{x}/{y}.png
```
#### Individual layers
The MapConfig specification holds the layers definition in a 0-based index. Layers can be requested individually in different formats depending on the layer type.
Individual layers can be accessed using that 0-based index. For UTF grid tiles:
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{layer}/{z}/{x}/{y}.grid.json
```
In this case, `layer` as 0 returns the UTF grid tiles/attributes for layer 0, the only layer in the example MapConfig.
If the MapConfig had a Torque layer at index 1 it could be possible to request it with:
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/1/{z}/{x}/{y}.torque.json
```
#### Attributes defined in `attributes` section
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{layer}/attributes/{feature_id}
```
Which returns JSON with the attributes defined, like:
```javascript
{ "c": 1, "d": 2 }
```
#### Blending and layer selection
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{layer_filter}/{z}/{x}/{y}.png
```
Note: currently format is limited to `png`.
`layer_filter` can be used to select some layers to be rendered together. `layer_filter` supports two formats:
- `all` alias
Using `all` as `layer_filter` will blend all layers in the layergroup
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/all/{z}/{x}/{y}.png
```
- Filter by layer index
A list of comma separated layer indexes can be used to just render a subset of layers. For example `0,3,4` will filter and blend layers with indexes 0, 3, and 4.
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/0,3,4/{z}/{x}/{y}.png
```
Some notes about filtering:
- Invalid index values or out of bounds indexes will end in `Invalid layer filtering` errors.
- Once a Mapnik layer is selected, all Mapnik layers will get blended. As this may change in the future **it is
recommended** to always select all Mapnik layers if you want to select at least one so you will get a consistent
behavior in the future.
- Ordering is not considered. So right now filtering layers 0,3,4 is the very same thing as filtering 3,4,0. As this
may change in the future **it is recommended** to always select the layers in ascending order so you will get a
consistent behavior in the future.
## Create JSONP
The JSONP endpoint is provided in order to allow web browsers access which don't support CORS.
#### Definition
```bash
GET /api/v1/map?callback=method
```
#### Params
Param | Description
--- | ---
config | Encoded JSON with the params for creating Named Maps (the variables defined in the template).
lmza | This attribute contains the same as config but LZMA compressed. It cannot be used at the same time as `config`.
callback | JSON callback name.
### Example
#### Call
```bash
curl "https://{username}.carto.com/api/v1/map?callback=callback&config=%7B%22version%22%3A%221.0.1%22%2C%22layers%22%3A%5B%7B%22type%22%3A%22cartodb%22%2C%22options%22%3A%7B%22sql%22%3A%22select+%2A+from+european_countries_e%22%2C%22cartocss%22%3A%22%23european_countries_e%7B+polygon-fill%3A+%23FF6600%3B+%7D%22%2C%22cartocss_version%22%3A%222.3.0%22%2C%22interactivity%22%3A%5B%22cartodb_id%22%5D%7D%7D%5D%7D"
```
#### Response
```javascript
callback({
layergroupid: "d9034c133262dfb90285cea26c5c7ad7:0",
cdn_url: {
"http": "http://cdb.com",
"https": "https://cdb.com"
},
last_updated: "1970-01-01T00:00:00.000Z"
})
```
## Remove
Anonymous Maps cannot be removed by an API call. They will expire after about five minutes, or sometimes longer. If an Anonymous Map expires and tiles are requested from it, an error will be raised. This could happen if a user leaves a map open and after time, returns to the map and attempts to interact with it in a way that requires new tiles (e.g. zoom). The client will need to go through the steps of creating the map again to fix the problem.

View File

@@ -0,0 +1 @@
## Example 1

View File

@@ -1,27 +0,0 @@
# General Concepts
The following concepts are the same for every endpoint in the API except when it's noted explicitly.
## Auth
By default, users do not have access to private tables in CARTO. In order to instantiate a map from private table data an API Key is required. Additionally, to include some endpoints, an API Key must be included (e.g. creating a Named Map).
To execute an authorized request, `api_key=YOURAPIKEY` should be added to the request URL. The param can be also passed as POST param. Using HTTPS is mandatory when you are performing requests that include your `api_key`.
## Errors
Errors are reported using standard HTTP codes and extended information encoded in JSON with this format:
```javascript
{
"errors": [
"access forbidden to table TABLE"
]
}
```
If you use JSONP, the 200 HTTP code is always returned so the JavaScript client can receive errors from the JSON object.
## CORS support
All the endpoints, which might be accessed using a web browser, add CORS headers and allow OPTIONS method.

View File

@@ -1,6 +1,6 @@
# Quickstart
## Quickstart
## Anonymous Maps
### Anonymous Maps
Here is an example of how to create an Anonymous Map with JavaScript:
@@ -31,7 +31,7 @@ $.ajax({
})
```
## Named Maps
### Named Maps
Let's create a Named Map using some private tables in a CARTO account.
The following map config sets up a map of European countries that have a white fill color:
@@ -58,7 +58,7 @@ The following map config sets up a map of European countries that have a white f
The MapConfig needs to be sent to CARTO's Map API using an authenticated call. Here we will use a command line tool called `curl`. For more info about this tool, see [this blog post](http://quickleft.com/blog/command-line-tutorials-curl), or type `man curl` in bash. Using `curl`, and storing the config from above in a file `MapConfig.json`, the call would look like:
#### Call
##### Call
```bash
curl 'https://{username}.carto.com/api/v1/map/named?api_key={api_key}' -H 'Content-Type: application/json' -d @mapconfig.json
@@ -66,7 +66,7 @@ curl 'https://{username}.carto.com/api/v1/map/named?api_key={api_key}' -H 'Conte
To get the `URL` to fetch the tiles you need to instantiate the map, where `template_id` is the template name from the previous response.
#### Call
##### Call
```bash
curl -X POST 'https://{username}.carto.com/api/v1/map/named/{template_id}' -H 'Content-Type: application/json'
@@ -76,7 +76,7 @@ The response will return JSON with properties for the `layergroupid`, the timest
Note: all `layers` in `metadata` will always have a `type` string and a `meta` dictionary with the key/value pairs.
#### Response
##### Response
```javascript
{

View File

@@ -0,0 +1,46 @@
## General Concepts
The following concepts are the same for every endpoint in the API except when it's noted explicitly.
### Auth
By default, users do not have access to private tables in CARTO. In order to instantiate a map from private table data an API Key is required. Additionally, an API Key is also required to use some of the API endpoints (e.g. to create a Named Map).
To execute an authorized request, `api_key=YOURAPIKEY` should be added to the request URL. The param can be also passed as POST param. Using HTTPS is mandatory when you are performing requests that include your `api_key`.
### Errors
Errors are reported using standard HTTP codes and extended information encoded in JSON with this format:
```javascript
{
"errors": [
"access forbidden to table TABLE"
]
}
```
If you use JSONP, the 200 HTTP code is always returned so the JavaScript client can receive errors from the JSON object.
### CORS Support
All the endpoints, which might be accessed using a web browser, add CORS headers and allow OPTIONS method.
### Map Tile Rendering
Map tiles create the graphical representation of your map in a web browser. The performance rendering of map tiles is dependent on the type of geospatial data model (raster or vector) that you are using.
- **Raster**: Generates map tiles based on a grid of pixels to represent your data. Each cell is a fixed size and contains values for particular map features. On the server-side, each request queries a dataset to retrieve data for each map tile. The grid size of map tiles can often lead to graphic quality issues.
- **Vector**: Generates map tiles based on pre-defined coordinates to represent your data, similar to how basemap image tiles are rendered. On the client-side, map tiles represent real-world geometries of a map. Depending on the coordinates, vertices are used to connect the data and display points, lines, or polygons for the map tiles.
**Note:** By default, CARTO uses vector graphics for map rendering. Please [contact us](mailto:support@carto.com) if you need raster rendering enabled as part of your requirements.
### Mapbox Vector Tiles (MVT)
[Mapbox Vector Tiles (MVT)](https://www.mapbox.com/vector-tiles/specification/) are map tiles that store geographic vector data on the client-side. Browser performance is fast since you can pan and zoom without having to query the server.
CARTO uses a Web Graphics Library (WebGL) to process MVT files. This is useful since WebGL's are compatible with most web browsers, include support for multiple client-side mapping engines, and do not require additional information from the server; which makes it more efficient for rendering map tiles.
**Tip:** You can process MVT files with the [`ST_AsMVT` PostGIS function](https://postgis.net/docs/manual-dev/ST_AsMVT.html) with the [Maps API Windshaft renderer](https://github.com/CartoDB/Windshaft/blob/1000x/lib/windshaft/renderers/pg_mvt/renderer.js).

View File

@@ -0,0 +1,396 @@
## Anonymous Maps
Anonymous Maps allows you to instantiate a map given SQL and CartoCSS. It also allows you to add interaction capabilities using [UTF Grid.](https://github.com/mapbox/utfgrid-spec).
Alternatively, you can get the data for the map (geometry and attributes for each layer) using vector tiles (in which case CartoCSS is not required).
### Instantiate
##### Definition
```html
POST /api/v1/map
```
##### Params
```javascript
{
"version": "1.3.0",
"layers": [{
"type": "mapnik",
"options": {
"cartocss_version": "2.1.1",
"cartocss": "#layer { polygon-fill: #FFF; }",
"sql": "select * from european_countries_e",
"interactivity": ["cartodb_id", "iso3"]
}
}]
}
```
See [MapConfig File Formats]({{site.mapsapi_docs}}/guides/MapConfig-file-format/) for details.
##### Response
The response includes:
Attributes | Description
--- | ---
layergroupid | The ID for that map, used to compose the URL for the tiles. The final URL is: `https://{username}.carto.com/api/v1/map/{layergroupid}/{z}/{x}/{y}.png`
updated_at | The ISO date of the last time the data involved in the query was updated.
metadata | Includes information about the layers.
cdn_url | URLs to fetch the data using the best CDN for your zone.
**Improved response metadata**
Originally, you needed to concantenate the `layergroupid` with the correct domain and the path for the tiles.
Now, for convenience, the layergroup includes the final URLs in two formats:
1. Leaflet's urlTemplate alike: useful when working with raster tiles or with libraries with an API similar to Leaflet's one.
1. [TileJSON spec](https://github.com/mapbox/tilejson-spec): useful when working with Mapbox GL or any other library that supports TileJSON.
#### Example
##### Call
```bash
curl 'https://{username}.carto.com/api/v1/map' -H 'Content-Type: application/json' -d @mapconfig.json
```
##### Response
```javascript
{
"layergroupid": "c01a54877c62831bb51720263f91fb33:0",
"last_updated": "1970-01-01T00:00:00.000Z",
"metadata": {
"layers": [
{
"type": "mapnik",
"meta": {}
}
],
"tilejson": {
"raster": {
"tilejson": "2.2.0",
"tiles": [
"http://a.cdb.com/c01a54877c62831bb51720263f91fb33/{z}/{x}/{y}.png",
"http://b.cdb.com/c01a54877c62831bb51720263f91fb33/{z}/{x}/{y}.png"
]
}
},
"url": {
"raster": {
"urlTemplate": "http://{s}.cdb.com/c01a54877c62831bb51720263f91fb33/{z}/{x}/{y}.png",
"subdomains": ["a", "b"]
}
}
},
"cdn_url": {
"http": "http://cdb.com",
"https": "https://cdb.com",
"templates": {
"http": { "subdomains": ["a","b"], "url": "http://{s}.cdb.com" },
"https": { "subdomains": ["a","b"], "url": "https://{s}.example.com" },
}
}
}
```
### Map Tile Rendering
Map tiles are used to create the graphic representation of your map in a web browser. Tiles can be requested either as pre-rendered *raster* tiles (images) or as *vector* map data to be rendered by the client (browser).
- **Raster**: If a tile is requested as a raster image format, like PNG, the map will be rendered on the server, using the CartoCSS styles defined in the layers of the map. It is necessary that all the layers of a map define CartoCSS styles in order to obtain raster tiles. Raster tiles are made up of 256x256 pixels; to avoid graphic quality issues tiles should be used unscaled to represent the zoom level (Z) for which they are requested. In order to render tiles, data will be retrieved from the database (in vector format) on the server-side.
- **Vector**: Tiles can also be requested as MVT (Mapbox Vector Tiles). In this case, only the geospatial vector data, without any styling, is returned. These tiles should be processed in the client-side to render the map. In this case layers do not need to define CartoCSS, as any rendering and styling will be performed on the client side. The vector data of a tile represents real-world geometries by defining the vertices of points, lines or polygons in a tile-specific coordinate system.
### Retrieve resources from the layergroup
When you have a layergroup, there are several resources for retrieving layergoup details such as, accessing Mapnik tiles, getting individual layers, accessing defined Attributes, and blending and layer selection.
#### Raster tiles
These raster tiles are PNG images that represent only the Mapnik layers of a map. See [individual layers](#individual-layers) for details about how to retrieve other layers.
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{z}/{x}/{y}.png
```
#### Mapbox Vector Tiles (MVT)
[Mapbox Vector Tiles (MVT)](https://www.mapbox.com/vector-tiles/specification/) are map tiles that transfer geographic vector data to the client-side. Browser performance is fast since you can pan and zoom without having to query the server.
CARTO uses Web Graphics Library (WebGL) to process MVT files on the browser. This is useful since WebGL is compatible with most web browsers, include support for multiple client-side mapping engines, and do not require additional information from the server; which makes it more efficient for rendering map tiles. However, you can use any implementation tool for processing MVT files.
The following examples describe how to fetch MVT tiles with a cURL request.
##### MVT and Windshaft
CARTO uses Windshaft as the map tiler library to render multilayer maps with the Maps API. You can use Windshaft to request MVT using the same layer type that is used for requesting raster tiles (Mapnik layer). Simply change the file format `.mvt` in the URL.
```bash
https://{username}.cartodb.com/api/v1/map/HASH/:layer/{z}/{x}/{y}.mvt
```
The following example instantiates an anonymous map with layer options:
```bash
{
user_name: 'mycartodbuser',
sublayers: [{
sql: "SELECT * FROM table_name";
cartocss: '#layer { marker-fill: #F0F0F0; }'
}],
maps_api_template: 'https://{user}.cartodb.com' // Optional
}
```
**Note**: If no layer type is specified, Mapnik tiles are used by default. To access MVT tiles, specify `https://{username}.cartodb.com/api/v1/map/HASH/{z}/{x}/{y}.mvt` as the `maps_api_template` variable.
**Tip:** If you are using [Named Maps]({{site.mapasapi_docs}}/guides/named-maps/) to instantiate a layer, indicate the MVT file format and layer in the response:
```bash
https://{username}.cartodb.com/api/v1/map/named/:templateId/:layer/{z}/{x}/{y}.mvt
```
For all layers in a Named Map, you must indicate Mapnik as the layer filter:
```bash
https://{username}.cartodb.com/api/v1/map/named/:templateId/mapnik/{z}/{x}/{y}.mvt
```
##### Layergroup Filter for MVT Tiles
To filter layers using Windshaft, use the following request where layers are numbered:
```bash
https://{username}.cartodb.com/api/v1/map/HASH/0,1,2/{z}/{x}/{y}.mvt
```
To request all layers, remove the layergroup filter parameter:
```bash
https://{username}.cartodb.com/api/v1/map/HASH/{z}/{x}/{y}.mvt
```
To filter a specific layer:
```bash
https://{username}.cartodb.com/api/v1/map/HASH/2/{z}/{x}/{y}.mvt
```
##### Example 1: MVT Tiles with Windshaft, CARTO.js, and MapboxGL
1) Import the required libraries:
```bash
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.9.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.9.0/mapbox-gl.css' rel='stylesheet' />
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.core.js"></script>
```
2) Configure Map Client:
```bash
mapboxgl.accessToken = '{yourMapboxToken}';
```
3) Create Map Object (Mapbox):
```bash
var map = new mapboxgl.Map({
container: 'map',
zoom: 1,
minZoom: 0,
maxZoom: 18,
center: [30, 0]
});
```
4) Define Layer Options (CARTO):
```bash
var layerOptions = {
user_name: "{username}",
sublayers: [{
sql: "SELECT * FROM {table_name}",
cartocss: "...",
}]
};
```
5) Request Tiles (from CARTO) and Set to Map Object (Mapbox):
**Note:** By default, [CARTO core functions]({{site.cartojs_docs}}/v3/guides/core-API-functionality/) retrieve URLs for fully rendered tiles. You must replace the default format (.png) with the MVT format (.mvt).
```bash
cartodb.Tiles.getTiles(layerOptions, function(result, err) {
var tiles = result.tiles.map(function(tileUrl) {
return tileUrl
.replace('{s}', 'a')
.replace(/\.png/, '.mvt');
});
map.setStyle(simpleStyle(tiles));
});
```
##### Example 2: MVT Libraries with Windshaft and MapboxGL
When you are not including CARTO.js to implement MVT tiles, you must use the `map.setStyle` parameter to specify vector map rendering.
1) Import the required libraries:
```bash
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.9.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.9.0/mapbox-gl.css' rel='stylesheet'/>
```
2) Configure Map Client:
```bash
mapboxgl.accessToken = '{yourMapboxToken}';
```
3) Create Map Object (Mapbox):
```bash
var map = new mapboxgl.Map({
container: 'map',
zoom: 1,
minZoom: 0,
maxZoom: 18,
center: [30, 0]
});
```
4) Set the Style
```bash
map.setStyle({
"version": 7,
"glyphs": "...",
"constants": {...},
"sources": {
"cartodb": {
"type": "vector",
"tiles": [ "http://{username}.cartodb.com/api/v1/map/named/templateId/mapnik/{z}/{x}/{y}.mvt"
],
"maxzoom": 18
}
},
"layers": [{...}]
});
```
**Tip:** If you are using MapboxGL, see the following resource for additional information.
- [MapboxGL API Reference](https://www.mapbox.com/mapbox-gl-js/api/)
- [MapboxGL Style Specifications](https://www.mapbox.com/mapbox-gl-js/style-spec/)
- [Example of MapboxGL Implementation](https://www.mapbox.com/mapbox-gl-js/examples/)
#### Individual layers
The MapConfig specification holds the layers definition in a 0-based index. Layers can be requested individually, in different formats, depending on the layer type.
Individual layers can be accessed using that 0-based index. For UTF grid tiles:
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{layer}/{z}/{x}/{y}.grid.json
```
In this case, `layer` as 0 returns the UTF grid tiles/attributes for layer 0, the only layer in the example MapConfig.
If the MapConfig had a Torque layer at index 1 it could be possible to request it with:
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/1/{z}/{x}/{y}.torque.json
```
#### Attributes defined in `attributes` section
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{layer}/attributes/{feature_id}
```
Which returns JSON with the attributes defined, such as:
```javascript
{ "c": 1, "d": 2 }
```
#### Blending and layer selection
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/{layer_filter}/{z}/{x}/{y}.png
```
Note: currently format is limited to `png`.
`layer_filter` can be used to select some layers to be rendered together. `layer_filter` supports two formats:
- `all` alias
Using `all` as `layer_filter` will blend all layers in the layergroup
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/all/{z}/{x}/{y}.png
```
- Filter by layer index
A list of comma separated layer indexes can be used to just render a subset of layers. For example `0,3,4` will filter and blend layers with indexes 0, 3, and 4.
```bash
https://{username}.carto.com/api/v1/map/{layergroupid}/0,3,4/{z}/{x}/{y}.png
```
Some notes about filtering:
- Invalid index values or out of bounds indexes will end in `Invalid layer filtering` errors.
- Ordering is not considered. So right now filtering layers 0,3,4 is the very same thing as filtering 3,4,0. As this may change in the future, **it is recommended** to always select the layers in ascending order so that you will always get consistent behavior.
### Create JSONP
The JSONP endpoint is provided in order to allow web browsers access which don't support CORS.
##### Definition
```bash
GET /api/v1/map?callback=method
```
##### Params
Param | Description
--- | ---
config | Encoded JSON with the params for creating Named Maps (the variables defined in the template).
lmza | This attribute contains the same as config but LZMA compressed. It cannot be used at the same time as `config`.
callback | JSON callback name.
#### Example
##### Call
```bash
curl "https://{username}.carto.com/api/v1/map?callback=callback&config=%7B%22version%22%3A%221.0.1%22%2C%22layers%22%3A%5B%7B%22type%22%3A%22cartodb%22%2C%22options%22%3A%7B%22sql%22%3A%22select+%2A+from+european_countries_e%22%2C%22cartocss%22%3A%22%23european_countries_e%7B+polygon-fill%3A+%23FF6600%3B+%7D%22%2C%22cartocss_version%22%3A%222.3.0%22%2C%22interactivity%22%3A%5B%22cartodb_id%22%5D%7D%7D%5D%7D"
```
##### Response
```javascript
callback({
layergroupid: "d9034c133262dfb90285cea26c5c7ad7:0",
cdn_url: {
"http": "http://cdb.com",
"https": "https://cdb.com"
},
last_updated: "1970-01-01T00:00:00.000Z"
})
```
### Remove
Anonymous Maps cannot be removed by an API call. They will expire after about five minutes, or sometimes longer. If an Anonymous Map expires and tiles are requested from it, an error will be raised. This could happen if a user leaves a map open and after time, returns to the map and attempts to interact with it in a way that requires new tiles (e.g. zoom). The client will need to go through the steps of creating the map again to fix the problem.

View File

@@ -1,12 +1,12 @@
# Named Maps
## Named Maps
Named Maps are essentially the same as Anonymous Maps except the MapConfig is stored on the server, and the map is given a unique name. You can create Named Maps from private data, and users without an API Key can view your Named Map (while keeping your data private).
Named Maps are essentially the same as Anonymous Maps except the MapConfig is stored on the server, and the map is given a unique name. You can create Named Maps from private data, and users without an API Key can view your Named Map (while keeping your data private).
The Named Map workflow consists of uploading a MapConfig file to CARTO servers, to select data from your CARTO user database by using SQL, and specifying the CartoCSS for your map.
The Named Map workflow consists of uploading a MapConfig file to CARTO servers, to select data from your CARTO user database by using SQL, and specifying the CartoCSS for your map.
The response back from the API provides the template_id of your Named Map as the `name` (the identifier of your Named Map), which is the name that you specified in the MapConfig. You can which you can then use to create your Named Map details, or [fetch XYZ tiles](#fetching-xyz-tiles-for-named-maps) directly for Named Maps.
The response back from the API provides the template_id of your Named Map as the `name` (the identifier of your Named Map), which is the name that you specified in the MapConfig. You can which you can then use to create your Named Map details, or [fetch XYZ tiles](#fetching-xyz-tiles-for-named-maps) directly for Named Maps.
**Tip:** You can also use a Named Map that you created (which is defined by its `name`), to create a map using CARTO.js. This is achieved by adding the [`namedmap` type](http://docs.carto.com/carto-engine/carto-js/layer-source-object/#named-maps-layer-source-object-type-namedmap) layer source object to draw the Named Map.
**Tip:** You can also use a Named Map that you created (which is defined by its `name`), to create a map using CARTO.js. This is achieved by adding the [`namedmap` type]({{site.cartojs_docs}}/v3/guides/layer-source-object/#named-maps-layer-source-object-type-namedmap) layer source object to draw the Named Map.
The main differences, compared to Anonymous Maps, is that Named Maps include:
@@ -16,26 +16,26 @@ The main differences, compared to Anonymous Maps, is that Named Maps include:
- **template map**
The template map is static and may contain placeholders, enabling you to modify your maps appearance by using variables. Templates maps are persistent with no preset expiration. They can only be created, or deleted, by a CARTO user with a valid API KEY (See [auth argument](#arguments)).
Uploading a MapConfig creates a Named Map. MapConfigs are uploaded to the server by sending the server a "template".json file, which contain the [MapConfig specifications](http://docs.carto.com/carto-engine/maps-api/mapconfig/).
Uploading a MapConfig creates a Named Map. MapConfigs are uploaded to the server by sending the server a "template".json file, which contain the [MapConfig specifications]({{site.mapsapi_docs}}/guides/MapConfig-file-format/).
**Note:** There is a limit of 4,096 Named Maps allowed per account. If you need to create more Named Maps, it is recommended to use a single Named Map and change the variables using [placeholders](#placeholder-format), instead of uploading multiple [Named Map MapConfigs](http://docs.carto.com/carto-engine/maps-api/mapconfig/#named-map-layer-options).
**Note:** There is a limit of 4,096 Named Maps allowed per account. If you need to create more Named Maps, it is recommended to use a single Named Map and change the variables using [placeholders](#placeholder-format), instead of uploading multiple [Named Map MapConfigs]({{site.mapsapi_docs}}/guides/MapConfig-file-format/#named-map-layer-options).
## Create
### Create
#### Definition
##### Definition
```html
POST /api/v1/map/named
```
#### Params
##### Params
Params | Description
--- | ---
api_key | is required
MapConfig | a [Named Map MapConfig](http://docs.carto.com/carto-engine/maps-api/mapconfig/#named-map-layer-options) is required to create a Named Map
MapConfig | a [Named Map MapConfig]({{site.mapsapi_docs}}/guides/MapConfig-file-format/#named-map-layer-options) is required to create a Named Map
#### template.json
##### template.json
The `name` argument defines how to name this "template_name".json. Note that there are some requirements for how to name a Named Map template. See the [`name`](#arguments) argument description for details.
@@ -84,33 +84,37 @@ The `name` argument defines how to name this "template_name".json. Note that the
"south": -45,
"east": 45,
"north": 45
},
"preview_layers": {
"0": true,
"layer1": false
}
}
}
```
#### Arguments
##### Arguments
Params | Description
--- | ---
name | There can only be _one_ template with the same name for any user. Valid names start with a letter or a number, and only contain letters, numbers, dashes (-), or underscores (_). _This is specific to the name of your Named Map that is specified in the `name` property of the template file_.
auth |
auth |
--- | ---
&#124;_ method | `"token"` or `"open"` (`"open"` is the default if no method is specified. Use `"token"` to password-protect your map)
&#124;_ valid_tokens | when `"method"` is set to `"token"`, the values listed here allow you to instantiate the Named Map. See this [example](http://docs.carto.com/faqs/manipulating-your-data/#how-to-create-a-password-protected-named-map) for how to create a password-protected map.
placeholders | Placeholders are variables that can be placed in your template.json file's SQL or CartoCSS.
layergroup | the layergroup configurations, as specified in the template. See [MapConfig File Format](http://docs.carto.com/carto-engine/maps-api/mapconfig/) for more information.
view (optional) | extra keys to specify the view area for the map. It can be used to have a static preview of a Named Map without having to instantiate it. It is possible to specify it with `center` + `zoom` or with a bounding box `bbox`. Center+zoom takes precedence over bounding box.
layergroup | the layergroup configurations, as specified in the template. See [MapConfig File Format]({{site.mapsapi_docs}}/guides/MapConfig-file-format/) for more information.
view (optional) | extra keys to specify the view area for the map. It can be used to have a static preview of a Named Map without having to instantiate it. It is possible to specify it with `center` + `zoom` or with a bounding box `bbox`. Center+zoom takes precedence over bounding box. Also it is possible to choose which layers are visible or not with `preview_layers` indicating its visibility by layer index or id (visible by default).
--- | ---
&#124;_ zoom | The zoom level to use
&#124;_ center |
&#124;_ center |
--- | ---
&#124;_ &#124;_ lng | The longitude to use for the center
&#124;_ &#124;_ lat | The latitude to use for the center
&#124;_ bounds |
&#124;_ bounds |
--- | ---
&#124;_ &#124;_ west | LowerCorner longitude for the bounding box, in decimal degrees (aka most western)
&#124;_ &#124;_ south | LowerCorner latitude for the bounding box, in decimal degrees (aka most southern)
@@ -118,13 +122,13 @@ view (optional) | extra keys to specify the view area for the map. It can be use
&#124;_ &#124;_ north | UpperCorner latitude for the bounding box, in decimal degrees (aka most northern)
### Placeholder Format
#### Placeholder Format
Placeholders are variables that can be placed in your template.json file. Placeholders need to be defined with a `type` and a default value for MapConfigs. See details about defining a MapConfig `type` for [Layergoup configurations](http://docs.carto.com/carto-engine/maps-api/mapconfig/#layergroup-configurations).
Placeholders are variables that can be placed in your template.json file. Placeholders need to be defined with a `type` and a default value for MapConfigs. See details about defining a MapConfig `type` for [Layergroup configurations]({{site.mapsapi_docs}}/guides/MapConfig-file-format/#layergroup-configurations).
Valid placeholder names start with a letter and can only contain letters, numbers, or underscores. They have to be written between the `<%=` and `%>` strings in order to be replaced inside the Named Maps API.
#### Example
##### Example
```javascript
<%= my_color %>
@@ -132,7 +136,7 @@ Valid placeholder names start with a letter and can only contain letters, number
The set of supported placeholders for a template need to be explicitly defined with a specific type, and default value, for each placeholder.
### Placeholder Types
#### Placeholder Types
The placeholder type will determine the kind of escaping for the associated value. Supported types are:
@@ -147,7 +151,7 @@ Placeholder default values will be used whenever new values are not provided as
When using templates, be very careful about your selections as they can give broad access to your data if they are defined loosely.
#### Call
##### Call
This is the call for creating the Named Map. It is sending the template.json file to the service, and the server responds with the template id.
@@ -158,9 +162,9 @@ curl -X POST \
'https://{username}.carto.com/api/v1/map/named?api_key={api_key}'
```
#### Response
##### Response
The response back from the API provides the name of your MapConfig as a template, enabling you to edit the Named Map details by inserting your variables into the template where placeholders are defined, and create custom queries using SQL.
The response back from the API provides the name of your MapConfig as a template, enabling you to edit the Named Map details by inserting your variables into the template where placeholders are defined, and create custom queries using SQL.
```javascript
{
@@ -168,17 +172,17 @@ The response back from the API provides the name of your MapConfig as a template
}
```
## Instantiate
### Instantiate
Instantiating a Named Map allows you to fetch the map tiles. You can use the Maps API to instantiate, or use the CARTO.js `createLayer()` function. The result is an Anonymous Map.
#### Definition
##### Definition
```html
POST /api/v1/map/named/{template_name}
```
#### Param
##### Param
Param | Description
--- | ---
@@ -196,14 +200,14 @@ The fields you pass as `params.json` depend on the variables allowed by the Name
**Note:** It is required that you include a `params.json` file to instantiate a Named Map that contains variables, even if you have no fields to pass and the JSON is empty. (This is specific to when a Named Map allows variables (if placeholders were defined in the template.json by the user).
#### Example
##### Example
You can initialize a template map by passing all of the required parameters in a POST to `/api/v1/map/named/{template_name}`.
Valid auth token will be needed, if required by the template.
#### Call
##### Call
```bash
curl -X POST \
@@ -212,7 +216,7 @@ curl -X POST \
'https://{username}.carto.com/api/v1/map/named/{template_name}?auth_token={auth_token}'
```
#### Response
##### Response
```javascript
{
@@ -221,7 +225,7 @@ curl -X POST \
}
```
#### Error
##### Error
```javascript
{
@@ -229,33 +233,33 @@ curl -X POST \
}
```
You can then use the `layergroupid` for fetching tiles and grids as you would normally (see [Anonymous Maps](http://docs.carto.com/carto-engine/maps-api/anonymous-maps/)).
You can then use the `layergroupid` for fetching tiles and grids as you would normally (see [Anonymous Maps]({{site.mapsapi_docs}}/guides/anonymous-maps/)).
## Update
### Update
#### Definition
##### Definition
```bash
PUT /api/v1/map/named/{template_name}
```
#### Params
##### Params
Param | Description
--- | ---
api_key | is required
#### Response
##### Response
Same as updating a map.
### Other Information
#### Other Information
Updating a Named Map removes all the Named Map instances, so they need to be initialized again.
### Example
#### Example
#### Call
##### Call
```bash
curl -X PUT \
@@ -264,7 +268,7 @@ curl -X PUT \
'https://{username}.carto.com/api/v1/map/named/{template_name}?api_key={api_key}'
```
#### Response
##### Response
```javascript
{
@@ -282,31 +286,31 @@ If a template with the same name does NOT exist, a 400 HTTP response is generate
}
```
## Delete
### Delete
Deletes the specified template map from the server, and disables any previously initialized versions of the map.
#### Definition
##### Definition
```bash
DELETE /api/v1/map/named/{template_name}
```
#### Params
##### Params
Param | Description
--- | ---
api_key | is required
### Example
#### Example
#### Call
##### Call
```bash
curl -X DELETE 'https://{username}.carto.com/api/v1/map/named/{template_name}?api_key={api_key}'
```
#### Response
##### Response
```javascript
{
@@ -316,31 +320,31 @@ curl -X DELETE 'https://{username}.carto.com/api/v1/map/named/{template_name}?ap
On success, a 204 (No Content) response will be issued. Otherwise a 4xx response with an error will be returned.
## Listing Available Templates
### Listing Available Templates
This allows you to get a list of all available templates.
#### Definition
##### Definition
```bash
GET /api/v1/map/named/
```
#### Params
##### Params
Param | Description
--- | ---
api_key | is required
### Example
#### Example
#### Call
##### Call
```bash
curl -X GET 'https://{username}.carto.com/api/v1/map/named?api_key={api_key}'
```
#### Response
##### Response
```javascript
{
@@ -348,7 +352,7 @@ curl -X GET 'https://{username}.carto.com/api/v1/map/named?api_key={api_key}'
}
```
#### Error
##### Error
```javascript
{
@@ -356,31 +360,31 @@ curl -X GET 'https://{username}.carto.com/api/v1/map/named?api_key={api_key}'
}
```
## Get Template Definition
### Get Template Definition
This gets the definition of a requested template.
#### Definition
##### Definition
```bash
GET /api/v1/map/named/{template_name}
```
#### Params
##### Params
Param | Description
--- | ---
api_key | is required
### Example
#### Example
#### Call
##### Call
```bash
curl -X GET 'https://{username}.carto.com/api/v1/map/named/{template_name}?api_key={api_key}'
```
#### Response
##### Response
```javascript
{
@@ -388,7 +392,7 @@ curl -X GET 'https://{username}.carto.com/api/v1/map/named/{template_name}?api_k
}
```
#### Error
##### Error
```javascript
{
@@ -396,17 +400,17 @@ curl -X GET 'https://{username}.carto.com/api/v1/map/named/{template_name}?api_k
}
```
## JSONP for Named Maps
### JSONP for Named Maps
If using a [JSONP](https://en.wikipedia.org/wiki/JSONP) (for old browsers) request, there is a special endpoint used to initialize and create a Named Map.
#### Definition
##### Definition
```bash
GET /api/v1/map/named/{template_name}/jsonp
```
#### Params
##### Params
Params | Description
--- | ---
@@ -415,13 +419,13 @@ params | Encoded JSON with the params (variables) needed for the Named Map
lmza | You can use an LZMA compressed file instead of a params JSON file
callback | JSON callback name
#### Call
##### Call
```bash
curl 'https://{username}.carto.com/api/v1/map/named/{template_name}/jsonp?auth_token={auth_token}&callback=callback&config=template_params_json'
```
#### Response
##### Response
```javascript
callback({
@@ -450,9 +454,9 @@ callback({
})
```
## CARTO.js for Named Maps
### CARTO.js for Named Maps
You can use a Named Map that you created (which is defined by its `name`), to create a map using CARTO.js. This is achieved by adding the [`namedmap` type](http://docs.carto.com/carto-engine/carto-js/layer-source-object/#named-maps-layer-source-object-type-namedmap) layer source object to draw the Named Map.
You can use a Named Map that you created (which is defined by its `name`), to create a map using CARTO.js. This is achieved by adding the [`namedmap` type]({{site.cartojs_docs}}/v3/guides/layer-source-object/#named-maps-layer-source-object-type-namedmap) layer source object to draw the Named Map.
```javascript
{
@@ -482,15 +486,15 @@ You can use a Named Map that you created (which is defined by its `name`), to cr
**Note:** Instantiating a Named Map over a `createLayer` does not require an API Key and by default, does not include auth tokens. _If_ you defined auth tokens for the Named Map configuration, then you will have to include them.
[CARTO.js](http://docs.carto.com/carto-engine/carto-js/) has methods for accessing your Named Maps.
[CARTO.js]({{site.cartojs_docs}}/v3/) has methods for accessing your Named Maps.
1. [layer.setParams()](http://docs.carto.com/carto-engine/carto-js/api-methods/#layersetparamskey-value) allows you to change the template variables (in the placeholders object) via JavaScript
1. [layer.setParams()]({{site.cartojs_docs}}/v3/reference/#layersetparamskey-value) allows you to change the template variables (in the placeholders object) via JavaScript
**Note:** The CARTO.js `layer.setParams()` function is not supported when using Named Maps for Torque. Alternatively, you can create a [Torque layer in a Named Map](http://bl.ocks.org/iriberri/de37be6406f9cc7cfe5a)
2. [layer.setAuthToken()](http://docs.carto.com/carto-engine/carto-js/api-methods/#layersetauthtokenauthtoken) allows you to set the auth tokens to create the layer
2. [layer.setAuthToken()](h{{site.cartojs_docs}}/v3/reference/#layersetauthtokenauth_token) allows you to set the auth tokens to create the layer
### Torque Layer in a Named Map
#### Torque Layer in a Named Map
If you are creating a Torque layer in a Named Map without using the Torque.js library, you can apply the Torque layer by applying the following code with CARTO.js:
@@ -516,26 +520,26 @@ If you are creating a Torque layer in a Named Map without using the Torque.js li
})
.addTo(map)
.done(function(layer) {
});
}
```
#### Examples of Named Maps created with CARTO.js
##### Examples of Named Maps created with CARTO.js
- [Named Map selectors with interaction](http://bl.ocks.org/ohasselblad/515a8af1f99d5e690484)
- [Named Map selectors with interaction](http://bl.ocks.org/andy-esch/515a8af1f99d5e690484)
- [Named Map with interactivity](http://bl.ocks.org/ohasselblad/d1a45b8ff5e7bd90cd68)
- [Named Map with interactivity](http://bl.ocks.org/andy-esch/d1a45b8ff5e7bd90cd68)
- [Toggling sublayers in a Named Map](http://bl.ocks.org/ohasselblad/c1a0f4913610eec53cd3)
- [Toggling sublayers in a Named Map](http://bl.ocks.org/andy-esch/c1a0f4913610eec53cd3)
## Fetching XYZ Tiles for Named Maps
### Fetching XYZ Tiles for Named Maps
Optionally, authenticated users can fetch projected tiles (XYZ tiles or Mapnik Retina tiles) for your Named Map.
### Fetch XYZ Tiles Directly with a URL
#### Fetch XYZ Tiles Directly with a URL
Authenticated users, with an auth token, can use XYZ-based URLs to fetch tiles directly, and instantiate the Named Map as part of the request to your application. You do not have to do any other steps to initialize your map.
Authenticated users, with an auth token, can use XYZ-based URLs to fetch tiles directly, and instantiate the Named Map as part of the request to your application. You do not have to do any other steps to initialize your map.
To call a template_id in a URL:
@@ -547,17 +551,17 @@ For example, a complete URL might appear as:
The placeholders indicate the following:
- [`template_id`](http://docs.carto.com/carto-engine/maps-api/named-maps/#response) is the response of your Named Map.
- layers can be a number (referring to the # layer of your map), all layers of your map, or a list of layers.
- [`template_id`]({{site.mapsapi_docs}}/guides/named-maps/#response) is the response of your Named Map.
- layers can be a number (referring to the ## layer of your map), all layers of your map, or a list of layers.
- To show just the basemap layer, enter the number value `0` in the layer placeholder "https://{username}.carto.com/api/v1/map/named/{template_id}/0/{z}/{x}/{y}.png"
- To show the first layer, enter the number value `1` in the layer placeholder "https://{username}.carto.com/api/v1/map/named/{template_id}/1/{z}/{x}/{y}.png"
- To show all layers, enter the value `all` for the layer placeholder "https://{username}.carto.com/api/v1/map/named/{template_id}/all/{z}/{x}/{y}.png"
- To show a [list of layers](http://docs.carto.com/carto-engine/maps-api/anonymous-maps/#blending-and-layer-selection), enter the comma separated layer value as 0,1,2 in the layer placeholder. For example, to show the basemap and the first layer, "https://{username}.carto.com/api/v1/map/named/{template_id}/0,1/{z}/{x}/{y}.png"
- To show a [list of layers]({{site.mapsapi_docs}}/guides/anonymous-maps/#blending-and-layer-selection), enter the comma separated layer value as 0,1,2 in the layer placeholder. For example, to show the basemap and the first layer, "https://{username}.carto.com/api/v1/map/named/{template_id}/0,1/{z}/{x}/{y}.png"
### Get Mapnik Retina Tiles
#### Get Mapnik Retina Tiles
Mapnik Retina tiles are not directly supported for Named Maps, so you cannot use the Named Map template_id. To fetch Mapnik Retina tiles, get the [layergroupid](http://docs.carto.com/carto-engine/maps-api/named-maps/#response-1) to initialize the map.
Mapnik Retina tiles are not directly supported for Named Maps, so you cannot use the Named Map template_id. To fetch Mapnik Retina tiles, get the [layergroupid]({{site.mapsapi_docs}}/guides/named-maps/#response-1) to initialize the map.
Instantiate the map by using your `layergroupid` in the token placeholder:

View File

@@ -1,24 +1,24 @@
# Static Maps API
## Static Maps API
The Static Maps API can be initiated using both Named and Anonymous Maps using the 'layergroupid' token. The API can be used to create static images of parts of maps and thumbnails for use in web design, graphic design, print, field work, and many other applications that require standard image formats.
The Static Maps API can be initiated using both Named and Anonymous Maps using the `layergroupid` token. The API can be used to create static images of parts of maps and thumbnails for use in web design, graphic design, print, field work, and many other applications that require standard image formats.
## Maps API endpoints
### Maps API endpoints
Begin by instantiating either a Named or Anonymous Map using the `layergroupid token` as demonstrated in the Maps API documentation above. The `layergroupid` token calls to the map and allows for parameters in the definition to generate static images.
Begin by instantiating either a Named or Anonymous Map using the `layergroupid` token as demonstrated in the Maps API documentation above. The `layergroupid` token calls to the map and allows for parameters in the definition to generate static images.
### Zoom + center
#### Zoom + center
#### Definition
##### Definition
```bash
GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format}
{% raw %}GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format}{{?}extra_options}{% endraw %}
```
#### Params
##### Params
Param | Description
--- | ---
token | the layergroupid token from the map instantiation
token | the `layergroupid` token from the map instantiation
z | the zoom level of the map
lat | the latitude for the center of the map
@@ -26,19 +26,19 @@ format | the format for the image, supported types: `png`, `jpg`
--- | ---
&#124;_ jpg | will have a default quality of 85.
### Bounding Box
#### Bounding Box
#### Definition
##### Definition
```bash
GET /api/v1/map/static/bbox/{token}/{bbox}/{width}/{height}.{format}`
```
#### Params
##### Params
Param | Description
--- | ---
token | the layergroupid token from the map instantiation
token | the `layergroupid` token from the map instantiation
bbox | the bounding box in WGS 84 (EPSG:4326), comma separated values for:
--- | ---
@@ -57,16 +57,19 @@ Note: you can see this endpoint as
```bash
GET /api/v1/map/static/bbox/{token}/{west},{south},{east},{north}/{width}/{height}.{format}`
```
#### Extra options
* Layer: List of layers to be shown in the image (by default `all`), for example `?layer=0,1`.
### Named Map
#### Definition
#### Named Map
##### Definition
```bash
GET /api/v1/map/static/named/{name}/{width}/{height}.{format}
```
#### Params
##### Params
Param | Description
--- | ---
@@ -78,9 +81,9 @@ format | the format for the image, supported types: `png`, `jpg`
--- | ---
&#124;_ jpg | will have a default quality of 85.
A Named Maps static image will get its constraints from the [`view` argument of the Create Named Map function](http://docs.carto.com/carto-engine/maps-api/named-maps/#arguments). If `view` is not defined, it will estimate the extent based on the involved tables, otherwise it fallbacks to `"zoom": 1`, `"lng": 0` and `"lat": 0`.
A Named Maps static image will get its constraints from the [`view` argument of the Create Named Map function]({{site.mapasapi_docs}}/guides/named-maps/). If `view` is not defined, it will estimate the extent based on the involved tables, otherwise it fallbacks to `"zoom": 1`, `"lng": 0` and `"lat": 0`.
#### Layers
##### Layers
The Static Maps API allows for multiple layers of incorporation into the `MapConfig` to allow for maximum versatility in creating a static map. The examples below were used to generate the static image example in the next section, and appear in the specific order designated.
@@ -124,7 +127,7 @@ By manipulating the `"urlTemplate"` custom basemaps can be used in generating st
**CARTO**
As described in the [MapConfig File Format](http://docs.carto.com/carto-engine/maps-api/mapconfig/), a "cartodb" type layer is now just an alias to a "mapnik" type layer as above, intended for backwards compatibility.
As described in the [MapConfig File Format]({{site.mapsapi_docs}}/guides/MapConfig-file-format/), a "cartodb" type layer is now just an alias to a "mapnik" type layer as above, intended for backwards compatibility.
```javascript
{
@@ -140,32 +143,37 @@ As described in the [MapConfig File Format](http://docs.carto.com/carto-engine/m
Additionally, static images from Torque maps and other map layers can be used together to generate highly customizable and versatile static maps.
### Caching
#### Caching
It is important to note that generated images are cached from the live data referenced with the `layergroupid token` on the specified CARTO account. This means that if the data changes, the cached image will also change. When linking dynamically, it is important to take into consideration the state of the data and longevity of the static image to avoid broken images or changes in how the image is displayed. To obtain a static snapshot of the map as it is today and preserve the image long-term regardless of changes in data, the image must be saved and stored locally.
It is important to note that generated images are cached from the live data referenced with the `layergroupid` token on the specified CARTO account. This means that if the data changes, the cached image will also change. When linking dynamically, it is important to take into consideration the state of the data and longevity of the static image to avoid broken images or changes in how the image is displayed. To obtain a static snapshot of the map as it is today and preserve the image long-term regardless of changes in data, the image must be saved and stored locally.
### Limits
#### Limits
* While images can encompass an entirety of a map, the default limit for pixel range is 8192 x 8192.
* Image resolution by default is set to 72 DPI
* JPEG quality by default is 85%
* Timeout limits for generating static maps are the same across the CARTO Editor and CARTO Engine. It is important to ensure timely processing of queries.
* While images can encompass an entirety of a map, the limit for pixel range is 8192 x 8192.
* Image resolution is set to 72 DPI
* JPEG quality is 85%
* Timeout limits for generating static maps are the same across CARTO Builder and CARTO Engine. It is important to ensure timely processing of queries.
* If you are publishing your map as a static image with the API, you must manually add [attributions](https://carto.com/attribution) for your static map image. For example, add the following attribution code:
## Examples
{% highlight javascript %}
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://carto.com/attributions">CARTO</a>
{% endhighlight %}
### Examples
After instantiating a map from a CARTO account:
#### Call
##### Call
```bash
GET /api/v1/map/static/center/{layergroupid}/{z}/{x}/{y}/{width}/{height}.png
```
#### Response
##### Response
<p class="wrap-border"><img src="https://raw.githubusercontent.com/namessanti/Pictures/master/static_api.png" alt="static-api"/></p>
### MapConfig
#### MapConfig
For this map, the multiple layers, order, and stylings are defined by the MapConfig.

View File

@@ -0,0 +1,264 @@
## Tile Aggregation
To be able to represent a large amount of data (say, hundred of thousands to millions of points) in a tile. This can be useful both for raster tiles (where the aggregation reduces the number of features to be rendered) and vector tiles (the tile contais less features).
Aggregation is available only for point geometries. During aggregation the points are grouped using a grid; all the points laying in the same cell of the grid are summarized in a single aggregated result point.
- The position of the aggregated point is controlled by the `placement` parameter.
- The aggregated rows always contain at least a column, named `_cdb_feature_count`, which contains the number of the original points that the aggregated point represents.
#### Special default aggregation
When no placement or columns are specified a special default aggregation is performed.
This special mode performs only spatial aggregation (using a grid defined by the requested tile and the resolution, parameter, as all the other cases), and returns a _random_ record from each group (grid cell) with all its columns and an additional `_cdb_feature_count` with the number of features in the group.
Regarding the randomness of the sample: currently we use the row with the minimum `cartodb_id` value in each group.
The rationale behind having this special aggregation with all the original columns is to provide a mostly transparent way to handle large datasets without having to provide special map configurations for those cases (i.e. preserving the logic used to produce the maps with smaller datasets). [Overviews have been used so far with this intent](https://carto.com/docs/tips-and-tricks/back-end-data-performance/), but they are inflexible.
#### User defined aggregations
When either a explicit placement or columns are requested we no longer use the special, query; we use one determined by the placement (which will default to "centroid"), and it will have as columns only the aggregated columns specified, in addition to `_cdb_feature_count`, which is always present.
We might decide in the future to allow sampling column values for any of the different placement modes.
#### Behaviour for raster and vector tiles
The vector tiles from a vector-only map will be aggregated by default.
However, Raster tiles (or vector tiles from a map which defines CartoCSS styles) will be aggregated only upon request.
Aggregation that would otherwise occur can be disabled by passing an `aggregation=false` parameter to the map instantiation HTTP call.
To control how aggregation is performed, an aggregation option can be added to the layer:
```json
{
"layers": [
{
"options": {
"sql": "SELECT * FROM data",
"aggregation": {
"placement": "centroid",
"columns": {
"value": {
"aggregate_function": "sum",
"aggregated_column": "value"
}
}
}
}
}
]
}
```
Even if aggregation is explicitly requested it may not be activated, e.g., if the geometries are not points
or the whole dataset is too small. The map instantiation response contains metadata that informs if any particular
layer will be aggregated when tiles are requested, both for vector (mvt) and raster (png) tiles.
```json
{
"layergroupid": "7b97b6e76590fef889b63edd2efb1c79:1513608333045",
"metadata": {
"layers": [
{
"type": "mapnik",
"id": "layer0",
"meta": {
"stats": {
"estimatedFeatureCount": 6232136
},
"aggregation": {
"png": true,
"mvt": true
}
}
}
]
}
}
```
### Aggregation parameters
The aggregation parameters for a layer are defined inside an `aggregation` option of the layer:
```json
{
"layers": [
{
"options": {
"sql": "SELECT * FROM data",
"aggregation": {"...": "..."}
}
}
]
}
```
#### `placement`
Determines the kind of aggregated geometry generated:
##### `point-sample`
This is the default placement. It will place the aggregated point at a random sample of the grouped points,
like the default aggregation does. No other attribute is sampled, though, the point will contain the aggregated attributes determined by the `columns` parameter.
##### `point-grid`
Generates points at the center of the aggregation grid cells (squares).
##### `centroid`
Generates points with the averaged coordinated of the grouped points (i.e. the points inside each grid cell).
#### `columns`
The aggregated attributes defined by `columns` are computed by a applying an _aggregate function_ to all the points in each group.
Valid aggregate functions are `sum`, `avg` (average), `min` (minimum), `max` (maximum) and `mode` (the most frequent value in the group).
The values to be aggregated are defined by the _aggregated column_ of the source data. The column keys define the name of the resulting column in the aggregated dataset.
For example here we define three aggregate attributes named `total`, `max_price` and `price` which are all computed with the same column, `price`,
of the original dataset applying three different aggregate functions.
```json
{
"columns": {
"total": { "aggregate_function": "sum", "aggregated_column": "price" },
"max_price": { "aggregate_function": "max", "aggregated_column": "price" },
"price": { "aggregate_function": "avg", "aggregated_column": "price" }
}
}
```
> Note that you can use the original column names as names of the result, but all the result column names must be unique. In particular, the names `cartodb_id`, `the_geom`, `the_geom_webmercator` and `_cdb_feature_count` cannot be used for aggregated columns, as they correspond to columns always present in the result.
#### `resolution`
Defines the cell-size of the spatial aggregation grid. This is equivalent to the [CartoCSS `-torque-resolution`]({{site.styling_cartocss}}/#-torque-resolution-float) property of Torque maps.
The aggregation cells are `resolution`×`resolution` pixels in size, where pixels here are defined to be 1/256 of the (linear) size of a tile.
The default value is 1, so that aggregation coincides with raster pixels. A value of 2 would make each cell to be 4 (2×2) pixels, and a value of
0.5 would yield 4 cells per pixel. In teneral values less than 1 produce sub-pixel precision.
> Note that is independent of the number of pixels for raster tile or the coordinate resolution (mvt_extent) of vector tiles.
#### `threshold`
This is the minimum number of (estimated) rows in the dataset (query results) for aggregation to be applied. If the number of rows estimate is less than the threshold aggregation will be disabled for the layer; the instantiation response will reflect that and tiles will be generated without aggregation.
#### Example
```json
{
"version": "1.7.0",
"extent": [-20037508.5, -20037508.5, 20037508.5, 20037508.5],
"srid": 3857,
"maxzoom": 18,
"minzoom": 3,
"layers": [
{
"type": "mapnik",
"options": {
"sql": "select * from table",
"cartocss": "#table { marker-width: [total]; marker-fill: ramp(value, (red, green, blue), jenks); }",
"cartocss_version": "2.3.0",
"aggregation": {
"placement": "centroid",
"columns": {
"value": {
"aggregate_function": "avg",
"aggregated_column": "value"
},
"total": {
"aggregate_function": "sum",
"aggregated_column": "value"
}
},
"resolution": 2,
"threshold": 500000
}
}
}
]
}
```
### `filters`
Aggregated data can be filtered by imposing filtering conditions on the aggregated columns.
Each condition is represented by one or more parameters:
* `{ "equal": V }` selects an specific value of the aggregated column.
* `{ "not_equal": V }` selects values different from the one specified.
* `{ "in": [v1, v2, v3] }` selects any value from a list.
* `{ "not_in": [v1, v2, v3] }` selects any value not in a list.
* `{ "less_than": v }` selects values strictly less than the one given.
* `{ "less_than_or_equal_to": v }` selects values less than or equal to the one given.
* `{ "greater_than": v }` selects values strictly greater than the one given.
* `{ "greater_than_or_equal_to": v }` selects values greater than or equal to the one given.
One of the *less* conditions can be combined with one of the *greater* conditions to select a range of values, for example:
* `{ "greater_than": v1, "less_than": v2 }`
* `{ "greater_than_or_equal_to": v1, "less_than": v2 }`
* `{ "greater_than": v1, "less_than_or_equal_to": v2 }`
* `{ "greater_than_or_equal_to": v1, "less_than_or_equal_to": v2 }`
For a given column, multiple conditions can be passed in an array; the conditions will logically ORed (any of the conditions have to be verifid for the value to be selected):
* `"myvalue": [ { "equal": 10 }, { "less_than": 0 }]` will select values of the column `myvalue` which are equal to 10 **or** less than 0.
In addition, the filters applied to different columns are logically combined with AND (all the conditions have to be satisfied for an element to be selected); for example with the following `filters` parameter we'll select aggregated records which have a `total_value` > 100 **and** a category equal to "a".
```json
{
"total_value": { "greater_than": 100 },
"category": { "equal": "a" }
}
```
Note that the filtered columns have to be defined with the `columns` parameter, except for `_cdb_feature_count`, which is always implicitly defined and can be filtered too.
#### Example
```json
{
"version": "1.7.0",
"extent": [-20037508.5, -20037508.5, 20037508.5, 20037508.5],
"srid": 3857,
"maxzoom": 18,
"minzoom": 3,
"layers": [
{
"type": "mapnik",
"options": {
"sql": "select * from table",
"cartocss": "#table { marker-width: [total]; marker-fill: ramp(value, (red, green, blue), jenks); }",
"cartocss_version": "2.3.0",
"aggregation": {
"placement": "centroid",
"columns": {
"total_value": {
"aggregate_function": "sum",
"aggregated_column": "value"
},
"category": {
"aggregate_function": "mode",
"aggregated_column": "category"
}
},
"filters" : {
"total_value": { "greater_than": 100 },
"category": { "equal": "a" }
},
"resolution": 2,
"threshold": 500000
}
}
}
]
}
```

View File

@@ -0,0 +1,270 @@
{% comment %}
The original resource for this was:
https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-1.4.0.md. However this is internal documenation only. This file (07-mapconfig.md) contains select content from the Windshaft internal doc. *I instructed @rochoa to add new Doc issues if/when they make a change to this content - so that the public docs can also be updated.
{% endcomment %}
## MapConfig File Format
CARTO uses Windshaft as the map tiler library to render multilayer maps with the [Maps API]({{ site.mapsapi_docs }}/). The MapConfig file is where these Windshaft layers are stored and applied. You can configure tiles and use the MapConfig document to request different resources for your map.
This section describes the MapConfig specifications, and required formats, when using the Maps API.
### Layergroup Configurations
The following MapConfig Layergroup configurations are applied using the [RFC 4627](http://www.ietf.org/rfc/rfc4627.txt) JSON format.
Layergroup Configuration | Description | Optional or Required?
--- | ---
`version` | Spec version to use for validation.<br /><br />**Note:** The default value is `"1.0.0"`. | Optional
`extent` | The default map extent for the map projection.<br /><br />**Note:** Currently, only webmercator is supported. | Optional
`srid` | The spatial reference identifier for the map. The default is `3857`. | Optional
`maxzoom` | The maximum zoom level for your map. A request beyond the defined maxzoom returns a 404 error.<br /><br />**Note:** The default value is undefined (infinite). | Optional
`minzoom` | The minimum zoom level for your map. A request beyond the defined minzoom returns a 404 error.<br /><br />**Note:** The default value is `0`. | Optional
`layers` | Defines the layer type, and the layers, in rendering order.<br /><br />**Note:** The following layers options are available: |
--- | ---
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> type | A string value that defines the layer type. You can define up to four values:<br /><br />`mapnik`, rasterized tiles<br /><br />`cartodb`, an alias for mapnik (for backward compatibility)<br /><br />`torque`, render vector tiles in torque format<br /><br />`http`, load tiles over HTTP<br /><br />`plain`, color or background image url<br /><br />`named`, use a Named Map as a layer | Required
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> options | An object value that sets different options for each layer type.<br /><br />**Note:** Options that are not defined in different layers will be discarded. | Required
#### Example of MapConfig
{% highlight json %}
{
"version": "1.7.0",
"extent": [-20037508.5, -20037508.5, 20037508.5, 20037508.5],
"srid": 3857,
"maxzoom": 18,
"minzoom": 3,
"layers": [
{
"type": "mapnik",
"options": {
"sql": "select * from table",
"cartocss": "#table { marker-placement: point; }",
"cartocss_version": "2.3.0"
}
}
]
}
{% endhighlight %}
---
### Mapnik Layer Options
If you are using Mapnik as a layer resource, the following configurations are required in your MapConfig file.
Mapnik Layer Option | Description | Optional or Required?
--- | ---
`sql` | A string value, the SQL request to the user database that will fetch the rendered data.<br /><br />**Tip:** The SQL request should include the following Mapnik layer configurations: `geom_column`, `interactivity`, and `attributes`, as described in this section.<br /><br />**Note:** The SQL request may contain substitutions tokens, such as `!bbox!`, `!pixel_width!`, and `!pixel_height!`. It is suggested to define the layergroup `minzoom` and `extent` variables to prevent errors. | Required
`cartocss` | A string value, specifying the CartoCSS style to render the tiles. If this is not present, only vector tiles can be requested for this layer. For a map to be valid either all the layers or none of them must have CartoCSS style.<br /><br />**Note:** The CartoCSS specification is dependent on the layer type. For details, see [mapnik-reference.json](https://github.com/mapnik/mapnik-reference). | Optional
`cartocss_version` | A string value, specifying the CartoCSS style version of the CartoCSS attribute.<br /><br />**Note:** The CartoCSS version is specific to the layer type. | Optional
`geom_column` | The name of the column containing the geometry. The default is `the_geom_webmercator`.<br /><br />*You must specify this value as part of the Mapnik layer `SQL`configuration. | *Optional
`geom_type` | Defines the type of column as either `geometry` (the default) or `raster`.<br /><br />**Note:** `geom_type` is not compatible with the Mapnik layer `interactivity` option. | Optional
`raster_band` | Defines the raster band (this option is only applicable when the `geom_type=raster`. The default value is `0`.<br /><br />**Note:** If the default, or no value is specified, raster bands are interpreted as either: grayscale (for single bands), RGB (for 3 bands), or RGBA (for 4 bands). | Optional
`srid` | The spatial reference identifier for the geometry column. The default is `3857`. | Optional
`affected_tables` | A string of values containing the tables that the Mapnik layer `SQL` configuration is using. This value is used if there is a problem guessing what the affected tables are from the SQL configuration (i.e. when using PL/SQL functions). | Optional
`interactivity` | A string of values that contains the fields rendered inside grid.json. All the parameters should be exposed as a result of executing the Mapnik layer `SQL` query.<br /><br />**Note:** `interactivity` is not compatible with the Mapnik layer `geom_type` option. For example, you cannot create a layergroup instance with a raster layer by defining the `geom_type=raster`.<br /><br />*You must specify this value as part of the Mapnik layer `SQL` configuration. | *Optional
`attributes`<a name="attributes"></a> | The id and column values returned by the Mapnik attributes service. (This option is disabled if no configuration is defined).<br /><br />*You must specify this value as part of the Mapnik layer `SQL`configuration.| *Optional
--- | ---
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> id | The key value used to fetch columns. | Required
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> columns | A string of values (columns) returned by the Mapnik attribute service. | Required
#### Example of Mapnik MapConfig
{% highlight json %}
{
"type": "mapnik",
"options": {
"sql": "select * from table",
"cartocss": "#layer { marker-placement: point; }",
"cartocss_version": "2.3.0",
"geom_column": "the_geom_webmercator",
"geom_type": "geometry",
"interactivity": [ "column1", "column2", "..."],
"attributes": {
"id": "cartodb_id",
"columns": ["column1", "column2"]
}
}
}
{% endhighlight %}
### Torque Layer Options
If you are using Torque as a layer resource, the following configurations are required in your MapConfig file. For more details about Torque layers in general, see the [Torque API]({{ site.torque_docs}}/reference/) documentation.
Torque Layer Option | Description | Optional or Required?
--- | ---
`sql` | A string value, the SQL request to the user database that will fetch the rendered data.<br /><br />**Tip:** The SQL request should include the following Torque layer configurations: `geom_column`, `interactivity`, and `attributes`, as described in this section. | Required
`cartocss` | A string value, specifying the CartoCSS style to render the tiles.<br /><br />**Note:** The CartoCSS specification is dependent on the layer type. For details, see [Torque cartocss-reference.js](https://github.com/CartoDB/torque/blob/master/lib/torque/cartocss_reference.js).| Required
`cartocss_version` | A string value, specifying the CartoCSS style version of the CartoCSS attribute.<br /><br />**Note:** The CartoCSS version is specific to the layer type. | Required
`step` | The number of [animation steps]({{site.styling_cartocss}}/-#torque-frame-count-number) to render when requesting a torque.png tile. The default value is `0`. | Optional
`geom_column` | The name of the column containing the geometry. The default is `the_geom_webmercator`.<br /><br />*You must specify this value as part of the Torque layer `SQL`configuration. | *Optional
`srid` | The spatial reference identifier for the geometry column. The default is `3857`. | Optional
`affected_tables` | A string of values containing the tables that the Mapnik layer `SQL` configuration is using. This value is used if there is a problem guessing what the affected tables are from the SQL configuration (i.e. when using PL/SQL functions). | Optional
`attributes` | The id and column values returned by the Torque attributes service. (This option is disabled if no configuration is defined).<br /><br />*You must specify this value as part of the Torque layer `SQL`configuration.| *Optional
--- | ---
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> id | The key value used to fetch columns. | Required
<i class="Icon Icon--s5 Icon--cGrey Icon--mAlign Icon--indent"></i> columns | A string of values (columns) returned by the Torque attribute service. | Required
#### Example of Torque MapConfig
{% highlight json %}
{
"type": "torque",
"options": {
"sql": "select * from table",
"cartocss": "#layer { ... }",
"cartocss_version": "1.0.0",
"geom_column": "the_geom_webmercator"
}
}
{% endhighlight %}
### HTTP Layer Options
If you are using an HTTP destination as the resource for a map layer, the following configurations are required in your MapConfig file.
HTTP Layer Option | Description | Optional or Required?
--- | ---
`urlTemplate` | A string value, end URL, from where the tile data is retrieved. _URLs must be included in the configuration whitelist to be valid._ <br /><br />**Note:** The {String} value includes:<br /><br />`{z}` as the zoom level<br /><br />`{x} and {y}` as the tile coordinates<br /><br />Optionally, the subdomain `{s}` may be included as part of the `urlTemplate` configuration. Otherwise, you can define the `subdomains` separately, as shown below. | Required
`subdomains` | A string of values used to retrieve tiles from different subdomains. The default value is [`a`, `b`, `c`] when `{s}` is defined in the `urlTemplate` configuration. Otherwise, the default value is `[ ]`.<br /><br />**Note:** The subdomains value will consistently replace the `{s}` value defined in the `urlTemplate`.| Optional
`tms` | A boolean value that specifies whether the tile is using Tile Map Service format. The default value is `false`.<br /><br />**Note:** If the value is `true`, the TMS inverses the Y axis numbering for tiles. | Optional
#### Example of HTTP MapConfig
{% highlight json %}
{
"type": "http",
"options": {
"urlTemplate": "http://{s}.example.com/{z}/{x}/{y}.png",
"subdomains": ["a", "b", "c"],
"tms": false
}
}
{% endhighlight %}
### Plain Layer Options
If you are using plain layer options as your map resource, the following configurations are required in your MapConfig file.
_**Note:** At least one of the plain layer options (either `color` or `imageUrl`) must be defined. If both options are defined, only `color` is used as part of the plain layer configuration._
Plain Layer Option | Description | Optional or Required?
--- | ---
`color` | A string value of numbers that defines the valid colors to include. The default value is `null`. Valid colors include:<br /><br />- A string value that includes CSS colors (i.e. `blue`) or a hex color string (i.e. `#0000ff`)<br /><br />- An integer array of r,g,b values (i.e. `[255,0,0]`)<br /><br />- An integer array of r,g,b,a values (i.e. `[255,0,0,128]`)<br /><br />* If **only** the `color` value is used for a plain layer, this value is Required.<br /><br />* If **both** `color` and `imageUrl` are defined, only the `color` value is used for the plain layer configuration.| *Both
`imageUrl` | A string value, end URL, from where the image is retrieved. The default value is `null`.<br /><br />* If **only** the `imageUrl` value is used for a plain layer, this value is Required.<br /><br />* If `color` is defined, this `imageUrl` value is ignored. | *Both
#### Example of Plain MapConfig
{% highlight json %}
{
"type": "plain",
"options": {
"color": "blue",
"imageUrl": "http://example.com/background.png"
}
}
{% endhighlight %}
### Named Map Layer Options
You can use a [Named Map]({{site.mapsapi_docs}}/guides/named-maps/) as a map layer. Note the following limitations before referencing the MapConfig options for a Named Map layer.
_**Limitations:**_
- A Named Map will not allow you to have `named` type layers inside of your template layergroup's layers definition
- A `named` layer does not allow Named Maps from other accounts. You can only use Named Maps from the _same_ user account
If you are using `named` layer options as your map resource, the following configurations are required in your MapConfig file.
Named Layer Option | Description | Optional or Required?
--- | ---
`name` | A string value, the name for the Named Map to use. | Required
`config` | An object, the replacement values for the Named Map's template placeholders. | Optional
`auth_tokens` | Strings array, the authorized tokens in case the Named Map has auth method set to `token`. | Optional
#### Example of Named MapConfig
{% highlight json %}
{
"type": "named",
"options": {
"name": "world_borders",
"config": {
"color": "#000"
},
"auth_tokens": ["token1", "token2"]
}
}
{% endhighlight %}
### Aggregation Options
The data used to render tiles, or contained in the tiles (for the case of vector tiles), can be spatially [aggregated]({{site.mapsapi_docs}}/guides/named-maps/) under some circumstances.
An `aggregation` attribute can be used in the layer `options` to control the aggregation. A value of `false` will disable aggregation for the layer. Otherwise, an object can be passed with the following aggregation parameters:
Parameter|Description|Default value
`placement`|Determines the kind of aggregated geometry generated ("point-sample", "point-grind" or "centroid").|"centroid"
`columns`|Defines aggregated columns; each one by an "aggregate_function" ("sum", "avg", "min, "max", "mode", "count") and "aggregated_column" name.|
`resolution`|Defines the cell-size of the spatial aggregation grid.|1 (for 256x256 cells per tile)
`threshold`|Minimum rows in the dataset to apply aggregation.
#### Example of Aggregation MapConfig
{% highlight json %}
{
"version": "1.7.0",
"extent": [-20037508.5, -20037508.5, 20037508.5, 20037508.5],
"srid": 3857,
"maxzoom": 18,
"minzoom": 3,
"layers": [
{
"type": "mapnik",
"options": {
"sql": "select * from table",
"cartocss": "#table { marker-width: [total]; marker-fill: ramp(value, (red, green, blue), jenks); }",
"cartocss_version": "2.3.0",
"aggregation": {
"placement": "centroid",s
"columns": {
"value": {
"aggregate_function": "avg",
"aggregated_column": "value"
},
"total": {
"aggregate_function": "sum",
"aggregated_column": "value"
}
},
"resolution": 2, // Aggregation cell is 2x2 pixels
"threshold": 500000
}
}
}
]
}
{% endhighlight %}
### MapConfig Requirements
All of these are MapConfig requirements for [Anonymous Maps]({{site.mapsapi_docs}}/guides/anonymous-maps/#retrieve-resources-from-the-layergroup).
- Identified by `{z}/{x}/{y}` path
- If applicable, additionally identified by `LAYER_NUMBER`
- Can be of different formats:
- png
- grid.json
- torque.json
- Static images/previews
- With a center or a bounding box
- Attributes
-Identified by LAYER_NUMBER and FEATURE_ID
**Tip:** The MapConfig file may be extended for specific uses. For example, [Windshaft-CartoDB](https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/MultiLayer-API.md) defines the addition of a `stat_tag` element in the config. This extension is also covered as part of the [Named Map Layer Options](#named-map-layer-options).

View File

@@ -0,0 +1,64 @@
## MapConfig Aggregation Extension
### 1. Purpose
This specification describes an extension for
[MapConfig 1.7.0](https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-1.7.0.md) version.
### 2. Changes over specification
This extension introduces a new layer options for aggregated data tile generation.
#### 2.1 Aggregation options
The layer options attribute is extended with a new optional `aggregation` attribute.
The value of this attribute can be `false` to explicitly disable aggregation for the layer.
```javascript
{
aggregation: {
// OPTIONAL
// string, defines the placement of aggregated geometries. Can be one of:
// * "point-sample", the default places geometries at a sample point (one of the aggregated geometries)
// * "point-grid" places geometries at the center of the aggregation grid cells
// * "centroid" places geometriea at the average position of the aggregated points
// See https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/aggregation.md#placement for more details
placement: "point-sample",
// OPTIONAL
// object, defines the columns of the aggregated datasets. Each property corresponds to a columns name and
// should contain an object with two properties: "aggregate_function" (one of "sum", "max", "min", "avg", "mode" or "count"),
// and "aggregated_column" (the name of a column of the original layer query or "*")
// A column defined as `"_cdb_feature_count": {"aggregate_function": "count", aggregated_column: "*"}`
// is always generated in addition to the defined columns.
// The column names `cartodb_id`, `the_geom`, `the_geom_webmercator` and `_cdb_feature_count` cannot be used
// for aggregated columns, as they correspond to columns always present in the result.
// See https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/aggregation.md#columns for more details
columns: {
"aggregated_column_1": {
"aggregate_function": "sum",
"aggregated_column": "original_column_1"
}
},
// OPTIONAL
// Number, defines the cell-size of the spatial aggregation grid as a pixel resolution power of two (1/4, 1/2,... 2, 4, 16)
// to scale from 256x256 pixels; the default is 1 corresponding to 256x256 cells per tile.
// See https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/aggregation.md#resolution for more details
resolution: 1,
// OPTIONAL
// Number, the minimum number of (estimated) rows in the dataset (query results) for aggregation to be applied.
// See https://github.com/CartoDB/Windshaft-cartodb/blob/master/docs/aggregation.md#threshold for more details
threshold: 500000
}
}
```
### History
#### 1.0.0
- Initial version

View File

@@ -1,16 +1,18 @@
# 1. Purpose
## MapConfig Analyses Extension
### 1. Purpose
This specification describes an extension for
[MapConfig 1.4.0](https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-1.4.0.md) version.
# 2. Changes over specification
### 2. Changes over specification
This extension targets layers with `sql` option, including layer types: `cartodb`, `mapnik`, and `torque`.
It extends MapConfig with a new attribute: `analyses`.
## 2.1 Analyses attribute
#### 2.1 Analyses attribute
The new analyses attribute must be an array of analyses as per [camshaft](https://github.com/CartoDB/camshaft). Each
analysis must adhere to the [camshaft-reference](https://github.com/CartoDB/camshaft/blob/0.8.0/reference/versions/0.7.0/reference.json) specification.
@@ -37,7 +39,7 @@ Basic analyses example:
]
```
# 2.2. Integration with layers
### 2.2. Integration with layers
As pointed before an analysis node id can be referenced from layers to consume its output query.
@@ -57,7 +59,7 @@ The layer consuming the output must reference it with the following option:
}
```
## 2.3. Complete example
#### 2.3. Complete example
```
{
@@ -86,8 +88,8 @@ The layer consuming the output must reference it with the following option:
}
```
# History
### History
## 1.0.0
#### 1.0.0
- Initial version

View File

@@ -1,57 +1,22 @@
# 1. Purpose
## MapConfig Dataviews Extension
### 1. Purpose
This specification describes an extension for
[MapConfig 1.4.0](https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-1.4.0.md) version.
# 2. Changes over specification
### 2. Changes over specification
This extension depends on Analyses extension. It extends MapConfig with a new attribute: `dataviews`.
It makes possible to get tabular data from analysis nodes: lists, aggregated lists, aggregations, and histograms.
It makes possible to get tabular data from analysis nodes: aggregated lists, aggregations, and histograms.
## 2.1. Dataview types
#### 2.1. Dataview types
### List
##### Aggregation
A list is a simple result set per row where is possible to retrieve several columns from the original layer query.
Definition
```
{
// REQUIRED
// string, `type` the list type
“type”: “list”,
// REQUIRED
// object, `options` dataview params
“options”: {
// REQUIRED
// array, `columns` to select for the list
“columns”: [“name”, “description”]
}
}
```
Expected output
```
{
"type": "list",
"rows": [
{
"{columnName1}": "val1",
"{columnName2}": 100
},
{
"{columnName1}": "val2",
"{columnName2}": 200
}
]
}
```
### Aggregation
An aggregation is very similar to a list but results are aggregated by a column and a given aggregation function.
An aggregation is a list with aggregated results by a column and a given aggregation function.
Definition
```
@@ -93,7 +58,7 @@ Expected output
}
```
### Histograms
##### Histograms
Histograms represent the data distribution for a column.
@@ -125,7 +90,7 @@ Expected output
}
```
### Formula
##### Formula
Formulas given a final value representing the whole dataset.
@@ -161,7 +126,7 @@ Result
```
## 2.2 Dataviews attribute
#### 2.2 Dataviews attribute
The new dataviews attribute must be a dictionary of dataviews.
@@ -182,7 +147,7 @@ The layer consuming the output must reference it with the following option:
}
```
## 2.3. Complete example
#### 2.3. Complete example
```
{
@@ -222,16 +187,16 @@ The layer consuming the output must reference it with the following option:
}
```
## 3. Filters
#### 3. Filters
Camshaft's analyses expose a filtering capability and `aggregation` and `histogram` dataviews get them for free with
this extension. Filters are available with the very dataview id, so if you have a "basic_histogram" histogram dataview
you can filter with a range filter with "basic_histogram" name.
## 3.1 Filter types
#### 3.1 Filter types
### Category
##### Category
Allows to remove results that are not contained within a set of elements.
Initially this filter can be applied to a `numeric` or `text` columns.
@@ -245,7 +210,7 @@ Params
}
```
### Range filter
##### Range filter
Allows to remove results that dont satisfy numeric min and max values.
Filter is applied to a numeric column.
@@ -259,13 +224,13 @@ Params
}
```
## 3.2. How to apply filters
#### 3.2. How to apply filters
Filters must be applied at map instantiation time.
With :mapconfig as a valid MapConfig and with :filters (a valid JSON) as:
### Anonymous map
##### Anonymous map
`GET /api/v1/map?config=:mapconfig&filters=:filters`
@@ -278,7 +243,7 @@ If in the future we need to support a bigger filters param and it doesnt fit
`POST /api/v1/map`
with `BODY={“config”: :mapconfig, “filters”: :filters}`
### Named map
##### Named map
Assume :params (a valid JSON) as named maps params, like in: `{“color”: “red”}`
@@ -294,7 +259,7 @@ If, again, in the future we need to support a bigger filters param that doesn
with `BODY={“config”: :params, “filters”: :filters}`
## 3.3 Bounding box special filter
#### 3.3 Bounding box special filter
A bounding box filter allows to remove results that dont satisfy a geospatial range.
@@ -307,8 +272,8 @@ param must be in the form `west,south,east,north`.
So applying a bbox filter to a dataview looks like:
GET /api/v1/map/:layergroupid/dataview/:dataview_name?bbox=-90,-45,90,45
# History
### History
## 1.0.0-alpha
#### 1.0.0-alpha
- WIP document

View File

@@ -1,14 +1,16 @@
# 1. Purpose
## MapConfig Named Maps Extension
### 1. Purpose
This specification describes an extension for
[MapConfig 1.3.0](https://github.com/CartoDB/Windshaft/blob/master/doc/MapConfig-1.3.0.md) version.
# 2. Changes over specification
### 2. Changes over specification
This extension introduces a new layer type so it's possible to use a Named Map by its name as a layer.
## 2.1 Named layers definition
#### 2.1 Named layers definition
```javascript
{
@@ -42,15 +44,15 @@ This extension introduces a new layer type so it's possible to use a Named Map b
}
```
## 2.2 Limitations
#### 2.2 Limitations
1. A Named Map will not allow to have `named` type layers inside their templates layergroup's layers definition.
2. A `named` layer does not allow Named Maps form other accounts, it's only possible to use Named Maps from the very
same user account.
# History
### History
## 1.0.0
#### 1.0.0
- Initial version

View File

@@ -1,4 +1,4 @@
The Windshaft-CartoDB MultiLayer API extends the [Windshaft MultiLayer API](https://github.com/CartoDB/Windshaft/blob/master/doc/Multilayer-API.md) in a few ways.
The Windshaft-CartoDB MultiLayer API extends the [Windshaft MultiLayer API](https://github.com/CartoDB/Windshaft/blob/master/doc/internal/multilayer-API.md) in a few ways.
## Last modification timestamp embedded in the token
@@ -25,4 +25,4 @@ Windshaft-CartoDB adds the following attributes in the response object
## Stats tag
Windshaft-CartoDB adds support for a ``stat_tag`` element in the multilayer configuration to help [stats](https://github.com/CartoDB/Windshaft-cartodb/wiki/Redis-stats-format) gathering.
Windshaft-CartoDB adds support for a ``stat_tag`` element in the multilayer configuration to help [stats](https://github.com/CartoDB/Windshaft-cartodb/wiki/Redis-stats-format) gathering.

1497
docs/reference/swagger.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
## Support Options
Feeling stuck? There are many ways to find help.
* Ask a question on [GIS StackExchange](https://gis.stackexchange.com/questions/tagged/carto) using the `CARTO` tag.
* [Report an issue](https://github.com/CartoDB/cartodb/issues) in Github.
* Engine Plan customers have additional access to enterprise-level support through CARTO's support representatives.
If you just want to describe an issue or share an idea, just <a class="typeform-share" href="https://cartohq.typeform.com/to/mH6RRl" data-mode="popup" target="_blank"> send your feedback</a>
### Issues on Github
If you think you may have found a bug, or if you have a feature request that you would like to share with the Maps API team, please [open an issue](https://github.com/CartoDB/Windshaft-cartodb/issues/new).
### Community support on GIS Stack Exchange
GIS Stack Exchange is the most popular community in the geospatial industry. This is a collaboratively-edited question and answer site for geospatial programmers and technicians. It is a fantastic resource for asking technical questions about developing and maintaining your application.
When posting a new question, please consider the following:
* Read the GIS Stack Exchange [help](https://gis.stackexchange.com/help) and [how to ask](https://gis.stackexchange.com/help/how-to-ask) pages for guidelines and tips about posting questions.
* Be very clear about your question in the subject. A clear explanation helps those trying to answer your question, as well as those who may be looking for information in the future.
* Be informative in your post. Details, code snippets, logs, screenshots, etc. help others to understand your problem.
* Use code that demonstrates the problem. It is very hard to debug errors without sample code to reproduce the problem.
### Engine Plan Customers
Engine Plan customers have additional support options beyond general community support. As per your account Terms of Service, you have access to enterprise-level support through CARTO's support representatives available at [enterprise-support@carto.com](mailto:enterprise-support@carto.com)
In order to speed up the resolution of your issue, provide as much information as possible (even if it is a link from community support). This allows our engineers to investigate your problem as soon as possible.
If you are not yet CARTO customer, browse our [plans & pricing](https://carto.com/pricing/) and find the right plan for you.

View File

@@ -0,0 +1,36 @@
## Contribute
CARTO platform is an open-source ecosystem. You can read about the [fundamentals]({{site.fundamental_docs}}/components/) of CARTO architecture and its components.
We are more than happy to receive your contributions to the code and the documentation as well.
## Filling a ticket
If you want to open a new issue in our repository, please follow these instructions:
1. Descriptive title.
2. Write a good description, it always helps.
3. Specify the steps to reproduce the problem.
4. Try to add an example showing the problem.
## Contributing code
Best part of open source, collaborate in Maps API code!. We like hearing from you, so if you have any bug fixed, or a new feature ready to be merged, those are the steps you should follow:
1. Fork the repository.
2. Create a new branch in your forked repository.
3. Commit your changes. Add new tests if it is necessary.
4. Open a pull request.
5. Any of the maintainers will take a look.
6. If everything works, it will merged and released \o/.
If you want more detailed information, this [GitHub guide](https://guides.github.com/activities/contributing-to-open-source/) is a must.
## Completing documentation
Maps API documentation is located in ```docs/```. That folder is the content that appears in the [Developer Center](https://carto.com/developers/maps-api/). Just follow the instructions described in [contributing code](#contributing-code) and after accepting your pull request, we will make it appear online :).
**Tip:** A convenient, easy way of proposing changes in documentation is by using the GitHub editor directly on the web. You can easily create a branch with your changes and make a PR from there.
## Submitting contributions
You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://carto.com/contributions).

View File

@@ -0,0 +1,121 @@
## Rate limiting
Rate limits ensure that CARTO platform is not flooded with so many requests it does not have the time and resources to service them all.
Of course, there is nothing we can do to prevent people from actually sending as many requests to our platform as they want, but requests over a user's rate limit will be acknowledged with an error so that the sender understands they need to lower the rate at which requests are sent before they are serviced again.
Currently, Maps API is affected by rate limiting.
### Per user and endpoint
Rate limit is on a per-user basis (or more accurately described, per user access) and by endpoint. For example, suppose you have 2 different apps (with 2 different maps) and both call to the same endpoint that allows 100 requests per second. Both apps/maps "share" 100 requests per second regardless the map calling to this endpoint.
### How it works
We are using the [generic cell rate algorithm](https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm), a [leaky bucket](https://en.wikipedia.org/wiki/Leaky_bucket) algorithm type.
The main keys to keep in mind about this algorithm and our implementation are:
- We allow a request every a certain time period
```
If an endpoint has a limit of 5 requests per second, you will have a request available every 200ms and when you spend all the available requests, you will need to wait 200ms to have another available request, instead of 1 second
```
- Most of the endpoints are limited per second
```
If an endpoint has a limit of 5 requests per second, after a second without requests, you will have at least 5 available requests
```
- Most of the endpoints allow an initial burst equal to the number of requests per second
```
If an endpoint has a limit of 5 requests per second, initially you will have 5 available requests
```
### Caches
In computing, a cache is a high-speed data storage layer which stores data, typically a set of data, so that future requests for that data are served up faster than by accessing the original location.
CARTO caching allows you to efficiently reuse previously retrieved or computed data, as the data in a cache is stored by CARTO in fast access hardware in combination with specific software to manage this.
Resources accessed by caches don't count against the limits. That is, any request that is handled by any cache layer is out of limits. You can always know which resources are served through cache looking at the `X-Cache` HTTP Header.
### HTTP Headers and Response Codes
When an application exceeds the rate limit for a given API endpoint, the API will return an HTTP `429 Too Many Requests` error.
Use the HTTP headers in order to understand where the application is at for a given rate limit, on the method that was just utilized. Note that the HTTP headers are contextual. That is, they indicate the rate limit for the user context. If you have multiple apps (maps) accessing to their resources with the same user, HTTP headers are related to that user.
- **Carto-Rate-Limit-Limit**: total allowed requests
- **Carto-Rate-Limit-Remaining**: remaining requests
- **Retry-After**: seconds until next available request (returns `-1` if the current request is allowed)
- **Carto-Rate-Limit-Reset**: seconds until the limit will reset to its maximum capacity
### Tips
We only have 1 tip:
- If you receive a rate limit error, you must wait the seconds indicated by the `Retry-After` HTTP header (most of the time will be 1 second)
### Rate Limits Chart
Below, you can find the values of the rate limit by user account type and endpoint. Note that endpoints not listed in the chart are disabled by default.
#### Enterprise plans
|Endpoint |Request |Time period |Burst |
| :--- | ---: | ---: | ---: |
| GET /api/v1/map <br> POST /api/v1/map |10 |1 |10 |
| GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format} <br> GET /api/v1/map/static/bbox/{token}/{west},{south},{east},{north}/{width}/{height}.{format} |3 |1 |3 |
| GET /api/v1/map/static/named/{template_id}/{width}/{height}.{format} |3 |1 |3 |
| GET /api/v1/map/{token}/{layer}/widget/{dataviewName} <br> GET /api/v1/map/{token}/dataview/{dataviewName} |25 |1 |25 |
| GET /{token}/{layer}/widget/{dataviewName}/search <br> GET /{token}/dataview/{dataviewName}/search |3 |1 |3 |
| GET /api/v1/map/{token}/analysis/node/{nodeId} |3 |1 |3 |
| GET /api/v1/map/{token}/{z}/{x}/{y}@{scale_factor}?x.{format} <br> GET /api/v1/map/{token}/{z}/{x}/{y}.{format} <br> GET /api/v1/map/{token}/{layer}/{z}/{x}/{y}.{format} |120<br> 1500 |1<br> 60 |120<br> 750 |
| GET /api/v1/map/{token}/{layer}/attributes/{fid} |10 |1 |10 |
| GET /api/v1/map/named |3 |1 |3 |
| POST /api/v1/map/named |3 |1 |3 |
| GET /api/v1/map/named/{template_id} |10 |1 |10 |
| POST /api/v1/map/named/{template_id} <br> GET /api/v1/map/named/{template_id}/jsonp |10 |1 |10 |
| PUT /api/v1/map/named/{template_id} |10 |1 |10 |
| DELETE /api/v1/map/named/{template_id} |3 |1 |3 |
| GET /api/v1/map/named/{template_id}/{layer}/{z}/{x}/{y}.{format} |25 |1 |25 |
#### Individual plans
|Endpoint |Request |Time period |Burst |
| :--- | ---: | ---: | ---: |
| GET /api/v1/map <br> POST /api/v1/map |5 |1 |5 |
| GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format} <br> GET /api/v1/map/static/bbox/{token}/{west},{south},{east},{north}/{width}/{height}.{format} |1 |1 |1 |
| GET /api/v1/map/static/named/{template_id}/{width}/{height}.{format} |1 |1 |1 |
| GET /api/v1/map/{token}/{layer}/widget/{dataviewName} <br> GET /api/v1/map/{token}/dataview/{dataviewName} |15 |1 |15 |
| GET /{token}/{layer}/widget/{dataviewName}/search <br> GET /{token}/dataview/{dataviewName}/search |1 |1 |1 |
| GET /api/v1/map/{token}/analysis/node/{nodeId} |1 |1 |1 |
| GET /api/v1/map/{token}/{z}/{x}/{y}@{scale_factor}?x.{format} <br> GET /api/v1/map/{token}/{z}/{x}/{y}.{format} <br> GET /api/v1/map/{token}/{layer}/{z}/{x}/{y}.{format} |40<br> 600 |1<br> 60 |40<br> 300 |
| GET /api/v1/map/{token}/{layer}/attributes/{fid} |5 |1 |5 |
| GET /api/v1/map/named |1 |1 |1 |
| POST /api/v1/map/named |1 |1 |1 |
| GET /api/v1/map/named/{template_id} |5 |1 |5 |
| POST /api/v1/map/named/{template_id} <br> GET /api/v1/map/named/{template_id}/jsonp |5 |1 |5 |
| PUT /api/v1/map/named/{template_id} |5 |1 |5 |
| DELETE /api/v1/map/named/{template_id} |1 |1 |1 |
| GET /api/v1/map/named/{template_id}/{layer}/{z}/{x}/{y}.{format} |10 |1 |10 |
#### Free plans
|Endpoint |Request |Time period |Burst |
| :--- | ---: | ---: | ---: |
| GET /api/v1/map <br> POST /api/v1/map |2 |1 |2 |
| GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format} <br> GET /api/v1/map/static/bbox/{token}/{west},{south},{east},{north}/{width}/{height}.{format} |1 |1 |1 |
| GET /api/v1/map/static/named/{template_id}/{width}/{height}.{format} |1 |1 |1 |
| GET /api/v1/map/{token}/{layer}/widget/{dataviewName} <br> GET /api/v1/map/{token}/dataview/{dataviewName} |10 |1 |10 |
| GET /{token}/{layer}/widget/{dataviewName}/search <br> GET /{token}/dataview/{dataviewName}/search |1 |1 |1 |
| GET /api/v1/map/{token}/analysis/node/{nodeId} |1 |1 |1 |
| GET /api/v1/map/{token}/{z}/{x}/{y}@{scale_factor}?x.{format} <br> GET /api/v1/map/{token}/{z}/{x}/{y}.{format} <br> GET /api/v1/map/{token}/{layer}/{z}/{x}/{y}.{format} |20<br> 600 |1<br> 60 |20<br> 300 |
| GET /api/v1/map/{token}/{layer}/attributes/{fid} |2 |1 |2 |
| GET /api/v1/map/named |1 |1 |1 |
| POST /api/v1/map/named |1 |1 |1 |
| GET /api/v1/map/named/{template_id} |2 |1 |2 |
| POST /api/v1/map/named/{template_id} <br> GET /api/v1/map/named/{template_id}/jsonp |2 |1 |2 |
| PUT /api/v1/map/named/{template_id} |2 |1 |2 |
| DELETE /api/v1/map/named/{template_id} |1 |1 |1 |
| GET /api/v1/map/named/{template_id}/{layer}/{z}/{x}/{y}.{format} |10 |1 |10 |

View File

@@ -0,0 +1,32 @@
## Timeout limit
Our APIs work following a request <-> response model. While CARTO is busy getting that action done or retrieving that information, part of our infrastructure is devoted to that process and is therefore unavailable for any other user. Typically this is not a problem, as most requests get serviced quickly enough. However, certain requests can take a long time to process, either by design (e.g., updating a huge table) or by mistake. To prevent this long-running queries from effectively blocking the usage of our platform resources, CARTO will discard requests that cannot be fulfilled in less than a certain amount of time.
Maps API is affected by this kind of limiting.
### Per User
Timeout limit is on a per-user basis (or more accurately described, per user access).
### How it works
Every query has a statement timeout. When a request reaches that value, the response returns an error.
### Response Codes
When query exceeds the timeout limit, the API will return an HTTP `429 Too Many Requests` error.
### Tips
You are able to avoid common issues that trigger timeout limits following these actions:
- Always use database indexes
- Try to use batch API to insert/update/delete data
### Timeout Limits Chart
Below, you can find the values of the timeout limit by user account type.
|Enterprise plans |Individual plans |Free plans |
| --- | --- | --- |
| 25 seconds | 15 seconds | 5 seconds |

View File

@@ -0,0 +1,16 @@
## Quota limiting
CARTO platform imposes limits on how much data you can store at CARTO, for every user account and organization. You can learn more about this topic by reading the [fundamentals about limits]({{site.fundamental_docs}}/limits/of the CARTO platform.
Maps API is affected by this kind of limiting.
### Quota Limits Chart
Below, you can find the values of the different quota limits by user account type.
|Limit |Enterprise plans |Individual plans |Free plans |
| :--- | ---: | ---: | ---: |
| Maximum Static Map image size |4000 X 4000 pixels |4000 X 4000 pixels |4000 X 4000 pixels |
| Maximum number of Named Maps |4096 |4096 |4096 |
| Maximum number of layers |10 |8 |8 |
| Maximum number of layers |16 |8 |8 |

View File

@@ -1,9 +1,10 @@
Windshaft-cartodb metrics
=========================
See [Windshaft metrics documentation](https://github.com/CartoDB/Windshaft/blob/master/doc/metrics.md) to understand the full picture.
## Metrics
See [metrics guide](https://github.com/CartoDB/Windshaft/blob/master/doc/metrics.md) to understand the full picture.
The next list includes the API endpoints, each endpoint may have several inner timers, some of them are displayed within this list as subitems. Find the description for them in the Inner timers section.
## Timers
### Timers
- **windshaft-cartodb.flush_cache**: time to flush the tile and sql cache
- **windshaft-cartodb.get_template**: time to retrieve an specific template
- **windshaft-cartodb.delete_template**: time to delete an specific template
@@ -39,4 +40,3 @@ Again, each inner timer may have several inner timers.
- **setDBConn**: time to retrieve from redis and set db host and db name from a user
- **setDBParams**: time to prepare all db params to be able to connect/query a database, see *setDBAuth* and *setDBConn*
- **tablePrivacy_getUserDBName**: time to retrieve from redis the database for a user

271
lib/api/api-router.js Normal file
View File

@@ -0,0 +1,271 @@
'use strict';
const { Router: router } = require('express');
const RedisPool = require('redis-mpool');
const cartodbRedis = require('cartodb-redis');
const { factory: windshaftFactory } = require('windshaft');
const PgConnection = require('../backends/pg-connection');
const AnalysisBackend = require('../backends/analysis');
const AnalysisStatusBackend = require('../backends/analysis-status');
const DataviewBackend = require('../backends/dataview');
const TemplateMaps = require('../backends/template-maps');
const PgQueryRunner = require('../backends/pg-query-runner');
const StatsBackend = require('../backends/stats');
const AuthBackend = require('../backends/auth');
const UserLimitsBackend = require('../backends/user-limits');
const OverviewsMetadataBackend = require('../backends/overviews-metadata');
const FilterStatsApi = require('../backends/filter-stats');
const TablesExtentBackend = require('../backends/tables-extent');
const ClusterBackend = require('../backends/cluster');
const PubSubMetricsBackend = require('../backends/metrics');
const LayergroupAffectedTablesCache = require('../cache/layergroup-affected-tables');
const SurrogateKeysCache = require('../cache/surrogate-keys-cache');
const VarnishHttpCacheBackend = require('../cache/backend/varnish-http');
const FastlyCacheBackend = require('../cache/backend/fastly');
const NamedMapProviderCache = require('../cache/named-map-provider-cache');
const NamedMapsCacheEntry = require('../cache/model/named-maps-entry');
const NamedMapProviderCacheReporter = require('../stats/reporter/named-map-provider-cache');
const SqlWrapMapConfigAdapter = require('../models/mapconfig/adapter/sql-wrap-mapconfig-adapter');
const MapConfigNamedLayersAdapter = require('../models/mapconfig/adapter/mapconfig-named-layers-adapter');
const MapConfigBufferSizeAdapter = require('../models/mapconfig/adapter/mapconfig-buffer-size-adapter');
const AnalysisMapConfigAdapter = require('../models/mapconfig/adapter/analysis-mapconfig-adapter');
const MapConfigOverviewsAdapter = require('../models/mapconfig/adapter/mapconfig-overviews-adapter');
const TurboCartoAdapter = require('../models/mapconfig/adapter/turbo-carto-adapter');
const DataviewsWidgetsAdapter = require('../models/mapconfig/adapter/dataviews-widgets-adapter');
const AggregationMapConfigAdapter = require('../models/mapconfig/adapter/aggregation-mapconfig-adapter');
const MapConfigAdapter = require('../models/mapconfig/adapter');
const VectorMapConfigAdapter = require('../models/mapconfig/adapter/vector-mapconfig-adapter');
const ResourceLocator = require('../models/resource-locator');
const LayergroupMetadata = require('../utils/layergroup-metadata');
const RendererStatsReporter = require('../stats/reporter/renderer');
const initializeStatusCode = require('./middlewares/initialize-status-code');
const initLogger = require('./middlewares/logger');
const bodyParser = require('body-parser');
const servedByHostHeader = require('./middlewares/served-by-host-header');
const profiler = require('./middlewares/profiler');
const lzmaMiddleware = require('./middlewares/lzma');
const cors = require('./middlewares/cors');
const user = require('./middlewares/user');
const sendResponse = require('./middlewares/send-response');
const syntaxError = require('./middlewares/syntax-error');
const errorMiddleware = require('./middlewares/error-middleware');
const clientHeader = require('./middlewares/client-header');
const MapRouter = require('./map/map-router');
const TemplateRouter = require('./template/template-router');
const getOnTileErrorStrategy = require('../utils/on-tile-error-strategy');
module.exports = class ApiRouter {
constructor ({ serverOptions, environmentOptions }) {
this.serverOptions = serverOptions;
const redisOptions = Object.assign({
name: 'windshaft-server',
unwatchOnRelease: false,
noReadyCheck: true
}, environmentOptions.redis);
const redisPool = new RedisPool(redisOptions);
redisPool.on('status', function (status) {
var keyPrefix = 'windshaft.redis-pool.' + status.name + '.db' + status.db + '.';
global.statsClient.gauge(keyPrefix + 'count', status.count);
global.statsClient.gauge(keyPrefix + 'unused', status.unused);
global.statsClient.gauge(keyPrefix + 'waiting', status.waiting);
});
const { rendererCache, tileBackend, attributesBackend, previewBackend, mapBackend, mapStore } = windshaftFactory({
rendererOptions: serverOptions,
redisPool,
onTileErrorStrategy: getOnTileErrorStrategy({ enabled: environmentOptions.enabledFeatures.onTileErrorStrategy }),
logger: this.serverOptions.logger
});
const rendererStatsReporter = new RendererStatsReporter(rendererCache, serverOptions.renderCache.statsInterval);
rendererStatsReporter.start();
const metadataBackend = cartodbRedis({ pool: redisPool });
const pgConnection = new PgConnection(metadataBackend);
const surrogateKeysCacheBackends = createSurrogateKeysCacheBackends(serverOptions);
const surrogateKeysCache = new SurrogateKeysCache(surrogateKeysCacheBackends);
const templateMaps = createTemplateMaps({ redisPool, surrogateKeysCache, logger: this.serverOptions.logger });
const analysisStatusBackend = new AnalysisStatusBackend();
const analysisBackend = new AnalysisBackend(metadataBackend, serverOptions.analysis);
const dataviewBackend = new DataviewBackend(analysisBackend);
const statsBackend = new StatsBackend();
const clusterBackend = new ClusterBackend();
const userLimitsBackend = new UserLimitsBackend(metadataBackend, {
limits: {
cacheOnTimeout: serverOptions.renderer.mapnik.limits.cacheOnTimeout || false,
render: serverOptions.renderer.mapnik.limits.render || 0,
rateLimitsEnabled: global.environment.enabledFeatures.rateLimitsEnabled
}
});
const authBackend = new AuthBackend(pgConnection, metadataBackend, mapStore, templateMaps);
const layergroupAffectedTablesCache = new LayergroupAffectedTablesCache();
if (process.env.NODE_ENV === 'test') {
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
}
const pgQueryRunner = new PgQueryRunner(pgConnection);
const overviewsMetadataBackend = new OverviewsMetadataBackend(pgQueryRunner);
const filterStatsBackend = new FilterStatsApi(pgQueryRunner);
const tablesExtentBackend = new TablesExtentBackend(pgQueryRunner);
const mapConfigAdapter = new MapConfigAdapter(
new MapConfigNamedLayersAdapter(templateMaps, pgConnection),
new MapConfigBufferSizeAdapter(),
new SqlWrapMapConfigAdapter(),
new DataviewsWidgetsAdapter(),
new AnalysisMapConfigAdapter(analysisBackend),
new VectorMapConfigAdapter(pgConnection),
new AggregationMapConfigAdapter(pgConnection),
new MapConfigOverviewsAdapter(overviewsMetadataBackend, filterStatsBackend),
new TurboCartoAdapter()
);
const resourceLocator = new ResourceLocator(global.environment);
const layergroupMetadata = new LayergroupMetadata(resourceLocator);
const namedMapProviderCache = new NamedMapProviderCache(
templateMaps,
pgConnection,
metadataBackend,
userLimitsBackend,
mapConfigAdapter,
layergroupAffectedTablesCache
);
const namedMapProviderCacheReporter = new NamedMapProviderCacheReporter({
namedMapProviderCache,
intervalInMilliseconds: serverOptions.renderCache.statsInterval
});
namedMapProviderCacheReporter.start();
const metricsBackend = new PubSubMetricsBackend(serverOptions.pubSubMetrics);
const collaborators = {
config: serverOptions,
analysisStatusBackend,
attributesBackend,
dataviewBackend,
previewBackend,
tileBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache,
templateMaps,
mapBackend,
metadataBackend,
mapConfigAdapter,
statsBackend,
layergroupMetadata,
namedMapProviderCache,
tablesExtentBackend,
clusterBackend,
metricsBackend
};
this.metadataBackend = metadataBackend;
this.mapRouter = new MapRouter({ collaborators });
this.templateRouter = new TemplateRouter({ collaborators });
}
route (app, routes) {
// FIXME: we need a better way to reset cache while running tests
if (process.env.NODE_ENV === 'test') {
app.layergroupAffectedTablesCache = this.layergroupAffectedTablesCache;
}
routes.forEach(route => {
const apiRouter = router({ mergeParams: true });
const { paths, middlewares = [] } = route;
apiRouter.use(initLogger({ logger: this.serverOptions.logger }));
apiRouter.use(user(this.metadataBackend));
apiRouter.use(profiler({
enabled: this.serverOptions.useProfiler,
statsClient: global.statsClient
}));
middlewares.forEach(middleware => apiRouter.use(middleware()));
apiRouter.use(initializeStatusCode());
apiRouter.use(bodyParser.json());
apiRouter.use(servedByHostHeader());
apiRouter.use(clientHeader());
apiRouter.use(lzmaMiddleware());
apiRouter.use(cors());
this.templateRouter.route(apiRouter, route.template);
this.mapRouter.route(apiRouter, route.map);
apiRouter.use(sendResponse());
apiRouter.use(syntaxError());
apiRouter.use(errorMiddleware());
paths.forEach(path => app.use(path, apiRouter));
});
}
};
function createTemplateMaps ({ redisPool, surrogateKeysCache, logger }) {
const templateMaps = new TemplateMaps(redisPool, {
max_user_templates: global.environment.maxUserTemplates
});
function invalidateNamedMap (user, templateName) {
const startTime = Date.now();
surrogateKeysCache.invalidate(new NamedMapsCacheEntry(user, templateName), (err) => {
if (err) {
return logger.error({ exception: err, 'cdb-user': user, template_id: templateName }, 'Named map invalidation failed');
}
const elapsed = Date.now() - startTime;
logger.info({ 'cdb-user': user, template_id: templateName, duration: elapsed / 1000, duration_ms: elapsed }, 'Named map invalidation success');
});
}
['update', 'delete'].forEach(function (eventType) {
templateMaps.on(eventType, invalidateNamedMap);
});
return templateMaps;
}
function createSurrogateKeysCacheBackends (serverOptions) {
var cacheBackends = [];
if (serverOptions.varnish_purge_enabled) {
cacheBackends.push(
new VarnishHttpCacheBackend(serverOptions.varnish_host, serverOptions.varnish_http_port)
);
}
if (serverOptions.fastly &&
!!serverOptions.fastly.enabled && !!serverOptions.fastly.apiKey && !!serverOptions.fastly.serviceId) {
cacheBackends.push(
new FastlyCacheBackend(serverOptions.fastly.apiKey, serverOptions.fastly.serviceId)
);
}
return cacheBackends;
}

View File

@@ -0,0 +1,148 @@
'use strict';
const PSQL = require('cartodb-psql');
const tag = require('../middlewares/tag');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const authorize = require('../middlewares/authorize');
const dbConnSetup = require('../middlewares/db-conn-setup');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const cacheControlHeader = require('../middlewares/cache-control-header');
const dbParamsFromResLocals = require('../../utils/database-params');
module.exports = class AnalysesController {
constructor (pgConnection, authBackend, userLimitsBackend) {
this.pgConnection = pgConnection;
this.authBackend = authBackend;
this.userLimitsBackend = userLimitsBackend;
}
route (mapRouter) {
mapRouter.get('/analyses/catalog', this.middlewares());
}
middlewares () {
return [
tag({ tags: ['analysis', 'catalog'] }),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ANALYSIS_CATALOG),
cleanUpQueryParams(),
createPGClient(),
getDataFromQuery({ queryTemplate: catalogQueryTpl, key: 'catalog' }),
getDataFromQuery({ queryTemplate: tablesQueryTpl, key: 'tables' }),
prepareResponse(),
cacheControlHeader({ ttl: 10, revalidate: true }),
unauthorizedError()
];
}
};
function createPGClient () {
return function createPGClientMiddleware (req, res, next) {
const dbParams = dbParamsFromResLocals(res.locals);
res.locals.pg = new PSQL(dbParams);
next();
};
}
function getDataFromQuery ({ queryTemplate, key }) {
const readOnlyTransactionOn = true;
return function getCatalogMiddleware (req, res, next) {
const { pg, user } = res.locals;
const sql = queryTemplate({ _username: user });
pg.query(sql, (err, resultSet = {}) => {
if (err) {
return next(err);
}
res.locals[key] = resultSet.rows || [];
next();
}, readOnlyTransactionOn);
};
}
function prepareResponse () {
return function prepareResponseMiddleware (req, res, next) {
const { catalog, tables } = res.locals;
const analysisIdToTable = tables.reduce((analysisIdToTable, table) => {
const analysisId = table.relname.split('_')[2];
if (analysisId && analysisId.length === 40) {
analysisIdToTable[analysisId] = table;
}
return analysisIdToTable;
}, {});
const analysisCatalog = catalog.map(analysis => {
if (Object.prototype.hasOwnProperty.call(analysisIdToTable, analysis.node_id)) {
analysis.table = analysisIdToTable[analysis.node_id];
}
return analysis;
})
.sort((analysisA, analysisB) => {
if (!!analysisA.table && !!analysisB.table) {
return analysisB.table.size - analysisA.table.size;
}
if (analysisA.table) {
return -1;
}
if (analysisB.table) {
return 1;
}
return -1;
});
res.statusCode = 200;
res.body = { catalog: analysisCatalog };
next();
};
}
function unauthorizedError () {
return function unathorizedErrorMiddleware (err, req, res, next) {
if (err.message.match(/permission\sdenied/)) {
err = new Error('Unauthorized');
err.http_status = 401;
}
next(err);
};
}
const catalogQueryTpl = ctx => `
SELECT analysis_def->>'type' as type, * FROM cartodb.cdb_analysis_catalog WHERE username = '${ctx._username}'
`;
var tablesQueryTpl = ctx => `
WITH analysis_tables AS (
SELECT
n.nspname AS nspname,
c.relname AS relname,
pg_total_relation_size(
format('%s.%s', pg_catalog.quote_ident(n.nspname), pg_catalog.quote_ident(c.relname))
) AS size,
format('%s.%s', pg_catalog.quote_ident(nspname), pg_catalog.quote_ident(relname)) AS fully_qualified_name
FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n
WHERE c.relnamespace = n.oid
AND pg_catalog.quote_ident(c.relname) ~ '^analysis_[a-z0-9]{10}_[a-z0-9]{40}$'
AND n.nspname IN ('${ctx._username}', 'public')
)
SELECT *, pg_size_pretty(size) as size_pretty
FROM analysis_tables
ORDER BY size DESC
`;

View File

@@ -0,0 +1,63 @@
'use strict';
const tag = require('../middlewares/tag');
const layergroupToken = require('../middlewares/layergroup-token');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const dbParamsFromResLocals = require('../../utils/database-params');
module.exports = class AnalysisLayergroupController {
constructor (analysisStatusBackend, pgConnection, userLimitsBackend, authBackend) {
this.analysisStatusBackend = analysisStatusBackend;
this.pgConnection = pgConnection;
this.userLimitsBackend = userLimitsBackend;
this.authBackend = authBackend;
}
route (mapRouter) {
mapRouter.get('/:token/analysis/node/:nodeId', this.middlewares());
}
middlewares () {
return [
tag({ tags: ['analysis', 'node'] }),
layergroupToken(),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ANALYSIS),
cleanUpQueryParams(),
analysisNodeStatus(this.analysisStatusBackend)
];
}
};
function analysisNodeStatus (analysisStatusBackend) {
return function analysisNodeStatusMiddleware (req, res, next) {
const { nodeId } = req.params;
const dbParams = dbParamsFromResLocals(res.locals);
analysisStatusBackend.getNodeStatus(nodeId, dbParams, (err, nodeStatus, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET NODE STATUS';
return next(err);
}
res.set({
'Cache-Control': 'public,max-age=5',
'Last-Modified': new Date().toUTCString()
});
res.statusCode = 200;
res.body = nodeStatus;
next();
});
};
}

View File

@@ -0,0 +1,242 @@
'use strict';
const windshaft = require('windshaft');
const MapConfig = windshaft.model.MapConfig;
const Datasource = windshaft.model.Datasource;
const tag = require('../middlewares/tag');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const checkJsonContentType = require('../middlewares/check-json-content-type');
const incrementMapViewCount = require('../middlewares/increment-map-view-count');
const augmentLayergroupData = require('../middlewares/augment-layergroup-data');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const lastUpdatedTimeLayergroup = require('../middlewares/last-updated-time-layergroup');
const layerStats = require('../middlewares/layer-stats');
const layergroupIdHeader = require('../middlewares/layergroup-id-header');
const layergroupMetadata = require('../middlewares/layergroup-metadata');
const mapError = require('../middlewares/map-error');
const CreateLayergroupMapConfigProvider = require('../../models/mapconfig/provider/create-layergroup-provider');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const metrics = require('../middlewares/metrics');
module.exports = class AnonymousMapController {
/**
* @param {AuthBackend} authBackend
* @param {PgConnection} pgConnection
* @param {TemplateMaps} templateMaps
* @param {MapBackend} mapBackend
* @param metadataBackend
* @param {SurrogateKeysCache} surrogateKeysCache
* @param {UserLimitsBackend} userLimitsBackend
* @param {LayergroupAffectedTables} layergroupAffectedTables
* @param {MapConfigAdapter} mapConfigAdapter
* @param {StatsBackend} statsBackend
* @constructor
*/
constructor (
config,
pgConnection,
templateMaps,
mapBackend,
metadataBackend,
surrogateKeysCache,
userLimitsBackend,
layergroupAffectedTables,
mapConfigAdapter,
statsBackend,
authBackend,
layergroupMetadata,
metricsBackend
) {
this.config = config;
this.pgConnection = pgConnection;
this.templateMaps = templateMaps;
this.mapBackend = mapBackend;
this.metadataBackend = metadataBackend;
this.surrogateKeysCache = surrogateKeysCache;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTables = layergroupAffectedTables;
this.mapConfigAdapter = mapConfigAdapter;
this.statsBackend = statsBackend;
this.authBackend = authBackend;
this.layergroupMetadata = layergroupMetadata;
this.metricsBackend = metricsBackend;
}
route (mapRouter) {
mapRouter.options('/');
mapRouter.get('/', this.middlewares());
mapRouter.post('/', this.middlewares());
}
middlewares () {
const useTemplateHash = false;
const includeQuery = true;
const label = 'ANONYMOUS LAYERGROUP';
const addContext = true;
const metricsTags = {
event: 'map_view',
attributes: { map_type: 'anonymous' },
from: {
req: {
query: { client: 'client' }
}
}
};
return [
tag({ tags: ['map', 'anonymous'] }),
metrics({
enabled: this.config.pubSubMetrics.enabled,
metricsBackend: this.metricsBackend,
tags: metricsTags
}),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ANONYMOUS),
cleanUpQueryParams(['aggregation']),
checkJsonContentType(),
checkCreateLayergroup(),
prepareAdapterMapConfig(this.mapConfigAdapter),
createLayergroup(
this.mapBackend,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTables
),
incrementMapViewCount(this.metadataBackend),
augmentLayergroupData(),
cacheControlHeader({ ttl: global.environment.varnish.layergroupTtl || 86400, revalidate: true }),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader(),
lastUpdatedTimeLayergroup(),
layerStats(this.pgConnection, this.statsBackend),
layergroupIdHeader(this.templateMaps, useTemplateHash),
layergroupMetadata(this.layergroupMetadata, includeQuery),
mapError({ label, addContext })
];
}
};
function checkCreateLayergroup () {
return function checkCreateLayergroupMiddleware (req, res, next) {
if (req.method === 'GET') {
const { config } = req.query;
if (!config) {
return next(new Error('layergroup GET needs a "config" parameter'));
}
try {
req.body = JSON.parse(config);
} catch (err) {
return next(err);
}
}
return next();
};
}
function prepareAdapterMapConfig (mapConfigAdapter) {
return function prepareAdapterMapConfigMiddleware (req, res, next) {
const requestMapConfig = req.body;
const { logger } = res.locals;
const { user, api_key: apiKey } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const params = Object.assign({ dbuser, dbname, dbpassword, dbhost, dbport }, req.query);
const context = {
analysisConfiguration: {
user,
logger,
db: {
host: dbhost,
port: dbport,
dbname: dbname,
user: dbuser,
pass: dbpassword
},
batch: {
username: user,
apiKey
}
}
};
mapConfigAdapter.getMapConfig(user,
requestMapConfig,
params,
context,
(err, requestMapConfig) => {
if (err) {
return next(err);
}
req.body = requestMapConfig;
res.locals.context = context;
next();
});
};
}
function createLayergroup (mapBackend, userLimitsBackend, pgConnection, affectedTablesCache) {
return function createLayergroupMiddleware (req, res, next) {
const requestMapConfig = req.body;
const { context } = res.locals;
const { user, cache_buster: cacheBuster, api_key: apiKey } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const params = {
cache_buster: cacheBuster,
api_key: apiKey,
dbuser,
dbname,
dbpassword,
dbhost,
dbport
};
const datasource = context.datasource || Datasource.EmptyDatasource();
const mapConfig = new MapConfig(requestMapConfig, datasource);
const mapConfigProvider = new CreateLayergroupMapConfigProvider(
mapConfig,
user,
userLimitsBackend,
pgConnection,
affectedTablesCache,
params
);
res.locals.mapConfig = mapConfig;
res.locals.mapConfigProvider = mapConfigProvider;
res.locals.analysesResults = context.analysesResults;
const mapParams = { dbuser, dbname, dbpassword, dbhost, dbport };
mapBackend.createLayergroup(mapConfig, mapParams, mapConfigProvider, (err, layergroup, stats = {}) => {
req.profiler.add(stats);
if (err) {
return next(err);
}
res.statusCode = 200;
res.body = layergroup;
next();
});
};
}

View File

@@ -0,0 +1,96 @@
'use strict';
const tag = require('../middlewares/tag');
const layergroupToken = require('../middlewares/layergroup-token');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
module.exports = class AttributesLayergroupController {
constructor (
attributesBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
) {
this.attributesBackend = attributesBackend;
this.pgConnection = pgConnection;
this.mapStore = mapStore;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
route (mapRouter) {
mapRouter.get('/:token/:layer/attributes/:fid', this.middlewares());
}
middlewares () {
return [
tag({ tags: ['attributes'] }),
layergroupToken(),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ATTRIBUTES),
cleanUpQueryParams(),
createMapStoreMapConfigProvider(
this.mapStore,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTablesCache
),
getFeatureAttributes(this.attributesBackend),
cacheControlHeader(),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader()
];
}
};
function getFeatureAttributes (attributesBackend) {
return function getFeatureAttributesMiddleware (req, res, next) {
const { mapConfigProvider } = res.locals;
const { token } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { layer, fid } = req.params;
const params = {
token,
dbuser,
dbname,
dbpassword,
dbhost,
dbport,
layer,
fid
};
attributesBackend.getFeatureAttributes(mapConfigProvider, params, false, (err, tile, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET ATTRIBUTES';
return next(err);
}
res.statusCode = 200;
res.body = tile;
next();
});
};
}

View File

@@ -0,0 +1,102 @@
'use strict';
const tag = require('../middlewares/tag');
const layergroupToken = require('../middlewares/layergroup-token');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
module.exports = class AggregatedFeaturesLayergroupController {
constructor (
clusterBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
) {
this.clusterBackend = clusterBackend;
this.pgConnection = pgConnection;
this.mapStore = mapStore;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
route (mapRouter) {
mapRouter.get('/:token/:layer/:z/cluster/:clusterId', this.middlewares());
}
middlewares () {
return [
tag({ tags: ['cluster'] }),
layergroupToken(),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
// TODO: create its rate limit
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ATTRIBUTES),
cleanUpQueryParams(['aggregation']),
createMapStoreMapConfigProvider(
this.mapStore,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTablesCache
),
getClusteredFeatures(this.clusterBackend),
cacheControlHeader(),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader()
];
}
};
function getClusteredFeatures (clusterBackend) {
return function getFeatureAttributesMiddleware (req, res, next) {
const { mapConfigProvider } = res.locals;
const { user, token } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { layer, z: zoom, clusterId } = req.params;
const { aggregation } = req.query;
const params = {
user,
token,
dbuser,
dbname,
dbpassword,
dbhost,
dbport,
layer,
zoom,
clusterId,
aggregation
};
clusterBackend.getClusterFeatures(mapConfigProvider, params, (err, features, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET CLUSTERED FEATURES';
return next(err);
}
res.statusCode = 200;
const { rows, fields } = features;
res.body = { rows, fields };
next();
});
};
}

View File

@@ -0,0 +1,148 @@
'use strict';
const tag = require('../middlewares/tag');
const layergroupToken = require('../middlewares/layergroup-token');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const ALLOWED_DATAVIEW_QUERY_PARAMS = [
'filters', // json
'own_filter', // 0, 1
'no_filters', // 0, 1
'bbox', // w,s,e,n
'circle', // json
'polygon', // json
'start', // number
'end', // number
'column_type', // string
'bins', // number
'aggregation', // string
'offset', // number
'q', // widgets search
'categories' // number
];
module.exports = class DataviewLayergroupController {
constructor (
dataviewBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
) {
this.dataviewBackend = dataviewBackend;
this.pgConnection = pgConnection;
this.mapStore = mapStore;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
route (mapRouter) {
// Undocumented/non-supported API endpoint methods.
// Use at your own peril.
mapRouter.get('/:token/dataview/:dataviewName', this.middlewares({
action: 'get',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW
}));
mapRouter.get('/:token/:layer/widget/:dataviewName', this.middlewares({
action: 'get',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW
}));
mapRouter.get('/:token/dataview/:dataviewName/search', this.middlewares({
action: 'search',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW_SEARCH
}));
mapRouter.get('/:token/:layer/widget/:dataviewName/search', this.middlewares({
action: 'search',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW_SEARCH
}));
}
middlewares ({ action, rateLimitGroup }) {
return [
tag({ tags: ['dataview', action] }),
layergroupToken(),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, rateLimitGroup),
cleanUpQueryParams(ALLOWED_DATAVIEW_QUERY_PARAMS),
createMapStoreMapConfigProvider(
this.mapStore,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTablesCache
),
action === 'search' ? dataviewSearch(this.dataviewBackend) : getDataview(this.dataviewBackend),
cacheControlHeader(),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader()
];
}
};
function getDataview (dataviewBackend) {
return function getDataviewMiddleware (req, res, next) {
const { user, mapConfigProvider } = res.locals;
const { dataviewName } = req.params;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const params = Object.assign({ dataviewName, dbuser, dbname, dbpassword, dbhost, dbport }, req.query);
dataviewBackend.getDataview(mapConfigProvider, user, params, (err, dataview, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET DATAVIEW';
return next(err);
}
res.statusCode = 200;
res.body = dataview;
next();
});
};
}
function dataviewSearch (dataviewBackend) {
return function dataviewSearchMiddleware (req, res, next) {
const { user, mapConfigProvider } = res.locals;
const { dataviewName } = req.params;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const params = Object.assign({ dbuser, dbname, dbpassword, dbhost, dbport }, req.query);
dataviewBackend.search(mapConfigProvider, user, dataviewName, params, (err, searchResult, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET DATAVIEW SEARCH';
return next(err);
}
res.statusCode = 200;
res.body = searchResult;
next();
});
};
}

156
lib/api/map/map-router.js Normal file
View File

@@ -0,0 +1,156 @@
'use strict';
const { Router: router } = require('express');
const AnalysisLayergroupController = require('./analysis-layergroup-controller');
const AttributesLayergroupController = require('./attributes-layergroup-controller');
const DataviewLayergroupController = require('./dataview-layergroup-controller');
const PreviewLayergroupController = require('./preview-layergroup-controller');
const TileLayergroupController = require('./tile-layergroup-controller');
const AnonymousMapController = require('./anonymous-map-controller');
const PreviewTemplateController = require('./preview-template-controller');
const AnalysesCatalogController = require('./analyses-catalog-controller');
const ClusteredFeaturesLayergroupController = require('./clustered-features-layergroup-controller');
module.exports = class MapRouter {
constructor ({ collaborators }) {
const {
config,
analysisStatusBackend,
attributesBackend,
dataviewBackend,
previewBackend,
tileBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache,
templateMaps,
mapBackend,
metadataBackend,
mapConfigAdapter,
statsBackend,
layergroupMetadata,
namedMapProviderCache,
tablesExtentBackend,
clusterBackend,
metricsBackend
} = collaborators;
this.analysisLayergroupController = new AnalysisLayergroupController(
analysisStatusBackend,
pgConnection,
userLimitsBackend,
authBackend
);
this.attributesLayergroupController = new AttributesLayergroupController(
attributesBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
);
this.dataviewLayergroupController = new DataviewLayergroupController(
dataviewBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
);
this.previewLayergroupController = new PreviewLayergroupController(
previewBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
);
this.tileLayergroupController = new TileLayergroupController(
tileBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
);
this.anonymousMapController = new AnonymousMapController(
config,
pgConnection,
templateMaps,
mapBackend,
metadataBackend,
surrogateKeysCache,
userLimitsBackend,
layergroupAffectedTablesCache,
mapConfigAdapter,
statsBackend,
authBackend,
layergroupMetadata,
metricsBackend
);
this.previewTemplateController = new PreviewTemplateController(
config,
namedMapProviderCache,
previewBackend,
surrogateKeysCache,
tablesExtentBackend,
metadataBackend,
pgConnection,
authBackend,
userLimitsBackend,
metricsBackend
);
this.analysesController = new AnalysesCatalogController(
pgConnection,
authBackend,
userLimitsBackend
);
this.clusteredFeaturesLayergroupController = new ClusteredFeaturesLayergroupController(
clusterBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
);
}
route (apiRouter, routes) {
const mapRouter = router({ mergeParams: true });
routes.forEach(route => {
const { paths, middlewares = [] } = route;
middlewares.forEach(middleware => mapRouter.use(middleware()));
this.analysisLayergroupController.route(mapRouter);
this.attributesLayergroupController.route(mapRouter);
this.dataviewLayergroupController.route(mapRouter);
this.previewLayergroupController.route(mapRouter);
this.tileLayergroupController.route(mapRouter);
this.anonymousMapController.route(mapRouter);
this.previewTemplateController.route(mapRouter);
this.analysesController.route(mapRouter);
this.clusteredFeaturesLayergroupController.route(mapRouter);
paths.forEach(path => apiRouter.use(path, mapRouter));
});
}
};

View File

@@ -0,0 +1,152 @@
'use strict';
const tag = require('../middlewares/tag');
const layergroupToken = require('../middlewares/layergroup-token');
const coordinates = require('../middlewares/coordinates');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const noop = require('../middlewares/noop');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const checkStaticImageFormat = require('../middlewares/check-static-image-format');
module.exports = class PreviewLayergroupController {
constructor (
previewBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
) {
this.previewBackend = previewBackend;
this.pgConnection = pgConnection;
this.mapStore = mapStore;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
route (mapRouter) {
mapRouter.get('/static/center/:token/:z/:lat/:lng/:width/:height.:format', this.middlewares({
validateZoom: true,
previewType: 'centered'
}));
mapRouter.get('/static/bbox/:token/:west,:south,:east,:north/:width/:height.:format', this.middlewares({
validateZoom: false,
previewType: 'bbox'
}));
}
middlewares ({ validateZoom, previewType }) {
const forcedFormat = 'png';
let getPreviewImage;
if (previewType === 'centered') {
getPreviewImage = getPreviewImageByCenter;
}
if (previewType === 'bbox') {
getPreviewImage = getPreviewImageByBoundingBox;
}
return [
tag({ tags: ['static', 'tile'] }),
layergroupToken(),
validateZoom ? coordinates({ z: true, x: false, y: false }) : noop(),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.STATIC),
cleanUpQueryParams(['layer']),
checkStaticImageFormat(),
createMapStoreMapConfigProvider(
this.mapStore,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTablesCache,
forcedFormat
),
getPreviewImage(this.previewBackend),
cacheControlHeader(),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader()
];
}
};
function getPreviewImageByCenter (previewBackend) {
return function getPreviewImageByCenterMiddleware (req, res, next) {
const width = +req.params.width;
const height = +req.params.height;
const zoom = +req.params.z;
const center = {
lng: +req.params.lng,
lat: +req.params.lat
};
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
const { mapConfigProvider } = res.locals;
const options = { mapConfigProvider, format, width, height, zoom, center };
previewBackend.getImage(options, (err, image, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'STATIC_MAP';
return next(err);
}
res.set('Content-Type', `image/${format}`);
res.statusCode = 200;
res.body = image;
next();
});
};
}
function getPreviewImageByBoundingBox (previewBackend) {
return function getPreviewImageByBoundingBoxMiddleware (req, res, next) {
const width = +req.params.width;
const height = +req.params.height;
const bbox = {
west: +req.params.west,
north: +req.params.north,
east: +req.params.east,
south: +req.params.south
};
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
const { mapConfigProvider } = res.locals;
const options = { mapConfigProvider, format, width, height, bbox };
previewBackend.getImage(options, (err, image, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'STATIC_MAP';
return next(err);
}
res.set('Content-Type', `image/${format}`);
res.statusCode = 200;
res.body = image;
next();
});
};
}

View File

@@ -0,0 +1,393 @@
'use strict';
const tag = require('../middlewares/tag');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const namedMapProvider = require('../middlewares/named-map-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const checkStaticImageFormat = require('../middlewares/check-static-image-format');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const metrics = require('../middlewares/metrics');
const DEFAULT_ZOOM_CENTER = {
zoom: 1,
center: {
lng: 0,
lat: 0
}
};
function numMapper (n) {
return +n;
}
module.exports = class PreviewTemplateController {
constructor (
config,
namedMapProviderCache,
previewBackend,
surrogateKeysCache,
tablesExtentBackend,
metadataBackend,
pgConnection,
authBackend,
userLimitsBackend,
metricsBackend
) {
this.config = config;
this.namedMapProviderCache = namedMapProviderCache;
this.previewBackend = previewBackend;
this.surrogateKeysCache = surrogateKeysCache;
this.tablesExtentBackend = tablesExtentBackend;
this.metadataBackend = metadataBackend;
this.pgConnection = pgConnection;
this.authBackend = authBackend;
this.userLimitsBackend = userLimitsBackend;
this.metricsBackend = metricsBackend;
}
route (mapRouter) {
mapRouter.get('/static/named/:template_id/:width/:height.:format', this.middlewares());
}
middlewares () {
const metricsTags = {
event: 'map_view',
attributes: { map_type: 'static' },
from: {
req: {
query: { client: 'client' }
}
}
};
return [
tag({ tags: ['named', 'static', 'tile'] }),
metrics({
enabled: this.config.pubSubMetrics.enabled,
metricsBackend: this.metricsBackend,
tags: metricsTags
}),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.STATIC_NAMED),
cleanUpQueryParams(['layer', 'zoom', 'lon', 'lat', 'bbox']),
checkStaticImageFormat(),
namedMapProvider({
namedMapProviderCache: this.namedMapProviderCache,
label: 'STATIC_VIZ_MAP',
forcedFormat: 'png'
}),
getTemplate({ label: 'STATIC_VIZ_MAP' }),
prepareLayerFilterFromPreviewLayers({
namedMapProviderCache: this.namedMapProviderCache,
label: 'STATIC_VIZ_MAP'
}),
getStaticImageOptions({ tablesExtentBackend: this.tablesExtentBackend }),
getImage({ previewBackend: this.previewBackend, label: 'STATIC_VIZ_MAP' }),
setContentTypeHeader(),
incrementMapViews({ metadataBackend: this.metadataBackend }),
cacheControlHeader(),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader()
];
}
};
function getTemplate ({ label }) {
return function getTemplateMiddleware (req, res, next) {
const { mapConfigProvider } = res.locals;
mapConfigProvider.getTemplate((err, template) => {
if (err) {
err.label = label;
return next(err);
}
res.locals.template = template;
next();
});
};
}
function prepareLayerFilterFromPreviewLayers ({ namedMapProviderCache, label }) {
return function prepareLayerFilterFromPreviewLayersMiddleware (req, res, next) {
const { template } = res.locals;
const { config, auth_token: authToken } = req.query;
if (!template || !template.view || !template.view.preview_layers) {
return next();
}
var previewLayers = template.view.preview_layers;
var layerVisibilityFilter = [];
template.layergroup.layers.forEach((layer, index) => {
if (previewLayers['' + index] !== false && previewLayers[layer.id] !== false) {
layerVisibilityFilter.push('' + index);
}
});
if (!layerVisibilityFilter.length) {
return next();
}
const { user, token, cache_buster: cacheBuster, api_key: apiKey } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { template_id: templateId, format } = req.params;
const params = {
user,
token,
cache_buster: cacheBuster,
api_key: apiKey,
dbuser,
dbname,
dbpassword,
dbhost,
dbport,
template_id: templateId,
format
};
// overwrites 'all' default filter
params.layer = layerVisibilityFilter.join(',');
// recreates the provider
namedMapProviderCache.get(user, templateId, config, authToken, params, (err, provider) => {
if (err) {
err.label = label;
return next(err);
}
res.locals.mapConfigProvider = provider;
next();
});
};
}
function getStaticImageOptions ({ tablesExtentBackend }) {
return function getStaticImageOptionsMiddleware (req, res, next) {
const { user, mapConfigProvider, template } = res.locals;
const { zoom, lon, lat, bbox } = req.query;
const params = { zoom, lon, lat, bbox };
const imageOpts = getImageOptions(params, template);
if (imageOpts) {
res.locals.imageOpts = imageOpts;
return next();
}
res.locals.imageOpts = DEFAULT_ZOOM_CENTER;
mapConfigProvider.createAffectedTables((err, affectedTables) => {
if (err) {
return next();
}
var tables = affectedTables.tables || [];
if (tables.length === 0) {
return next();
}
tablesExtentBackend.getBounds(user, tables, (err, bounds) => {
if (err) {
return next();
}
res.locals.imageOpts = bounds;
return next();
});
});
};
}
function getImageOptions (params, template) {
const { zoom, lon, lat, bbox } = params;
let imageOpts = getImageOptionsFromCoordinates(zoom, lon, lat);
if (imageOpts) {
return imageOpts;
}
imageOpts = getImageOptionsFromBoundingBox(bbox);
if (imageOpts) {
return imageOpts;
}
imageOpts = getImageOptionsFromTemplate(template, zoom);
if (imageOpts) {
return imageOpts;
}
}
function getImageOptionsFromCoordinates (zoom, lon, lat) {
if ([zoom, lon, lat].map(numMapper).every(Number.isFinite)) {
return {
zoom: zoom,
center: {
lng: lon,
lat: lat
}
};
}
}
function getImageOptionsFromTemplate (template, zoom) {
if (template.view) {
var zoomCenter = templateZoomCenter(template.view);
if (zoomCenter) {
if (Number.isFinite(+zoom)) {
zoomCenter.zoom = +zoom;
}
return zoomCenter;
}
var bounds = templateBounds(template.view);
if (bounds) {
return bounds;
}
}
}
function getImageOptionsFromBoundingBox (bbox = '') {
var _bbox = bbox.split(',').map(numMapper);
if (_bbox.length === 4 && _bbox.every(Number.isFinite)) {
return {
bbox: {
west: _bbox[0],
south: _bbox[1],
east: _bbox[2],
north: _bbox[3]
}
};
}
}
function getImage ({ previewBackend, label }) {
return function getImageMiddleware (req, res, next) {
const { imageOpts, mapConfigProvider } = res.locals;
const { zoom, center, bbox } = imageOpts;
let { width, height } = req.params;
width = +width;
height = +height;
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
if (zoom !== undefined && center) {
const options = { mapConfigProvider, format, width, height, zoom, center };
return previewBackend.getImage(options, (err, image, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = label;
return next(err);
}
res.statusCode = 200;
res.body = image;
next();
});
}
const options = { mapConfigProvider, format, width, height, bbox };
previewBackend.getImage(options, (err, image, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = label;
return next(err);
}
res.statusCode = 200;
res.body = image;
next();
});
};
}
function setContentTypeHeader () {
return function setContentTypeHeaderMiddleware (req, res, next) {
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
res.set('Content-Type', `image/${format}`);
next();
};
}
function incrementMapViews ({ metadataBackend }) {
return function incrementMapViewsMiddleware (req, res, next) {
const { user, mapConfigProvider, logger } = res.locals;
mapConfigProvider.getMapConfig((err, mapConfig) => {
if (err) {
logger.warn({ exception: err }, 'Failed to increment mapview count');
return next();
}
res.locals.mapConfig = mapConfig;
const statTag = mapConfig.obj().stat_tag;
metadataBackend.incMapviewCount(user, statTag, (err) => {
if (err) {
logger.warn({ exception: err }, 'Failed to increment mapview count');
}
next();
});
});
};
}
function templateZoomCenter (view) {
if (view.zoom !== undefined && view.center) {
return {
zoom: view.zoom,
center: view.center
};
}
return false;
}
function templateBounds (view) {
if (view.bounds) {
var hasAllBounds = ['west', 'south', 'east', 'north'].every(prop => Number.isFinite(view.bounds[prop]));
if (hasAllBounds) {
return {
bbox: {
west: view.bounds.west,
south: view.bounds.south,
east: view.bounds.east,
north: view.bounds.north
}
};
} else {
return false;
}
}
return false;
}

View File

@@ -0,0 +1,167 @@
'use strict';
const tag = require('../middlewares/tag');
const layergroupToken = require('../middlewares/layergroup-token');
const coordinates = require('../middlewares/coordinates');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const createMapStoreMapConfigProvider = require('../middlewares/map-store-map-config-provider');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const vectorError = require('../middlewares/vector-error');
const SUPPORTED_FORMATS = {
grid_json: true,
json_torque: true,
torque_json: true,
png: true,
png32: true,
mvt: true
};
module.exports = class TileLayergroupController {
constructor (
tileBackend,
pgConnection,
mapStore,
userLimitsBackend,
layergroupAffectedTablesCache,
authBackend,
surrogateKeysCache
) {
this.tileBackend = tileBackend;
this.pgConnection = pgConnection;
this.mapStore = mapStore;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
route (mapRouter) {
// REGEXP: doesn't match with `val`
const not = (val) => `(?!${val})([^\/]+?)`; // eslint-disable-line no-useless-escape
// Sadly the path that matches 1 also matches with 2 so we need to tell to express
// that performs only the middlewares of the first path that matches
// for that we use one array to group all paths.
mapRouter.get([
'/:token/:z/:x/:y@:scale_factor?x.:format', // 1
'/:token/:z/:x/:y.:format', // 2
`/:token${not('static')}/:layer/:z/:x/:y.(:format)`
], this.middlewares());
}
middlewares () {
return [
tag({ tags: ['tile'] }),
layergroupToken(),
coordinates(),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.TILE),
cleanUpQueryParams(),
createMapStoreMapConfigProvider(
this.mapStore,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTablesCache
),
getTile(this.tileBackend),
cacheControlHeader(),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader(),
incrementSuccessMetrics(global.statsClient),
incrementErrorMetrics(global.statsClient),
tileError(),
vectorError()
];
}
};
function parseFormat (format = '') {
const prettyFormat = format.replace('.', '_');
return SUPPORTED_FORMATS[prettyFormat] ? prettyFormat : 'invalid';
}
function getStatusCode (tile, format) {
return tile.length === 0 && format === 'mvt' ? 204 : 200;
}
function getTile (tileBackend) {
return function getTileMiddleware (req, res, next) {
const { mapConfigProvider } = res.locals;
const { token } = res.locals;
const { layer, z, x, y, format } = req.params;
const params = { token, layer, z, x, y, format };
tileBackend.getTile(mapConfigProvider, params, (err, tile, headers, stats = {}) => {
req.profiler.add(stats);
if (err) {
return next(err);
}
if (headers) {
res.set(headers);
}
const formatStat = parseFormat(req.params.format);
res.statusCode = getStatusCode(tile, formatStat);
res.body = tile;
next();
});
};
}
function incrementSuccessMetrics (statsClient) {
return function incrementSuccessMetricsMiddleware (req, res, next) {
const formatStat = parseFormat(req.params.format);
statsClient.increment('windshaft.tiles.success');
statsClient.increment(`windshaft.tiles.${formatStat}.success`);
next();
};
}
function incrementErrorMetrics (statsClient) {
return function incrementErrorMetricsMiddleware (err, req, res, next) {
const formatStat = parseFormat(req.params.format);
statsClient.increment('windshaft.tiles.error');
statsClient.increment(`windshaft.tiles.${formatStat}.error`);
next(err);
};
}
function tileError () {
return function tileErrorMiddleware (err, req, res, next) {
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/68
let errMsg = err.message ? ('' + err.message) : ('' + err);
// Rewrite mapnik parsing errors to start with layer number
const matches = errMsg.match("(.*) in style 'layer([0-9]+)'");
if (matches) {
errMsg = `style${matches[2]}: ${matches[1]}`;
}
err.message = errMsg;
err.label = 'TILE RENDER';
next(err);
};
}

View File

@@ -0,0 +1,16 @@
'use strict';
const _ = require('underscore');
module.exports = function augmentLayergroupData () {
return function augmentLayergroupDataMiddleware (req, res, next) {
const layergroup = res.body;
// include in layergroup response the variables in serverMedata
// those variables are useful to send to the client information
// about how to reach this server or information about it
_.extend(layergroup, global.environment.serverMetadata);
next();
};
};

View File

@@ -0,0 +1,19 @@
'use strict';
module.exports = function authorize (authBackend) {
return function authorizeMiddleware (req, res, next) {
authBackend.authorize(req, res, (err, authorized) => {
if (err) {
return next(err);
}
if (!authorized) {
err = new Error('Sorry, you are unauthorized (permission denied)');
err.http_status = 403;
return next(err);
}
return next();
});
};
};

View File

@@ -0,0 +1,26 @@
'use strict';
module.exports = function setCacheChannelHeader () {
return function setCacheChannelHeaderMiddleware (req, res, next) {
if (req.method !== 'GET') {
return next();
}
const { mapConfigProvider, logger } = res.locals;
mapConfigProvider.getAffectedTables((err, affectedTables) => {
if (err) {
logger.warn({ exception: err }, 'Error generating Cache Channel Header');
return next();
}
if (!affectedTables) {
return next();
}
res.set('X-Cache-Channel', affectedTables.getCacheChannel());
next();
});
};
};

View File

@@ -0,0 +1,85 @@
'use strict';
const ONE_MINUTE_IN_SECONDS = 60;
const THREE_MINUTE_IN_SECONDS = 60 * 3;
const FIVE_MINUTES_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 5;
const TEN_MINUTES_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 10;
const FIFTEEN_MINUTES_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 15;
const THIRTY_MINUTES_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 30;
const ONE_HOUR_IN_SECONDS = ONE_MINUTE_IN_SECONDS * 60;
const ONE_YEAR_IN_SECONDS = ONE_HOUR_IN_SECONDS * 24 * 365;
const FALLBACK_TTL = global.environment.varnish.fallbackTtl || FIVE_MINUTES_IN_SECONDS;
const validFallbackTTL = [
ONE_MINUTE_IN_SECONDS,
THREE_MINUTE_IN_SECONDS,
FIVE_MINUTES_IN_SECONDS,
TEN_MINUTES_IN_SECONDS,
FIFTEEN_MINUTES_IN_SECONDS,
THIRTY_MINUTES_IN_SECONDS,
ONE_HOUR_IN_SECONDS
];
module.exports = function setCacheControlHeader ({
ttl = ONE_YEAR_IN_SECONDS,
fallbackTtl = FALLBACK_TTL,
revalidate = false
} = {}) {
if (!validFallbackTTL.includes(fallbackTtl)) {
const message = [
'Invalid fallback TTL value for Cache-Control header.',
`Got ${fallbackTtl}, expected ${validFallbackTTL.join(', ')}`
].join(' ');
throw new Error(message);
}
return function setCacheControlHeaderMiddleware (req, res, next) {
if (req.method !== 'GET') {
return next();
}
const { mapConfigProvider = { getAffectedTables: callback => callback() }, logger } = res.locals;
mapConfigProvider.getAffectedTables((err, affectedTables) => {
if (err) {
logger.warn({ exception: err }, 'Error generating Cache Control Header');
return next();
}
const directives = ['public'];
if (everyAffectedTableCanBeInvalidated(affectedTables)) {
directives.push(`max-age=${ttl}`);
} else {
directives.push(`max-age=${computeNextTTL({ ttlInSeconds: fallbackTtl })}`);
}
if (revalidate) {
directives.push('must-revalidate');
}
res.set('Cache-Control', directives.join(','));
next();
});
};
};
function everyAffectedTableCanBeInvalidated (affectedTables) {
const skipNotUpdatedAtTables = false;
const skipAnalysisCachedTables = true;
return affectedTables &&
affectedTables.getTables(skipNotUpdatedAtTables, skipAnalysisCachedTables)
.every(table => table.updated_at !== null);
}
function computeNextTTL ({ ttlInSeconds } = {}) {
const nowInSeconds = Math.ceil(Date.now() / 1000);
const secondsAfterPreviousTTLStep = nowInSeconds % ttlInSeconds;
const secondsToReachTheNextTTLStep = ttlInSeconds - secondsAfterPreviousTTLStep;
return secondsToReachTheNextTTLStep;
}

View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function checkJsonContentType () {
return function checkJsonContentTypeMiddleware (req, res, next) {
if (req.method === 'POST' && !req.is('application/json')) {
return next(new Error('POST data must be of type application/json'));
}
next();
};
};

View File

@@ -0,0 +1,13 @@
'use strict';
const VALID_IMAGE_FORMATS = ['png', 'jpg'];
module.exports = function checkStaticImageFormat () {
return function checkStaticImageFormatMiddleware (req, res, next) {
if (!VALID_IMAGE_FORMATS.includes(req.params.format)) {
return next(new Error(`Unsupported image format "${req.params.format}"`));
}
next();
};
};

View File

@@ -0,0 +1,31 @@
'use strict';
const _ = require('underscore');
// Whitelist query parameters and attach format
const REQUEST_QUERY_PARAMS_WHITELIST = [
'config',
'map_key',
'api_key',
'auth_token',
'callback',
'zoom',
'lon',
'lat',
// analysis
'filters' // json
];
module.exports = function cleanUpQueryParamsMiddleware (customQueryParams = []) {
if (!Array.isArray(customQueryParams)) {
throw new Error('customQueryParams must receive an Array of params');
}
return function cleanUpQueryParams (req, res, next) {
const allowedQueryParams = [...REQUEST_QUERY_PARAMS_WHITELIST, ...customQueryParams];
req.query = _.pick(req.query, allowedQueryParams);
next();
};
};

View File

@@ -0,0 +1,13 @@
'use strict';
module.exports = function clientHeader () {
return function clientHeaderMiddleware (req, res, next) {
const { client } = req.query;
if (client) {
res.set('Carto-Client', client);
}
return next();
};
};

View File

@@ -0,0 +1,43 @@
'use strict';
const positiveIntegerNumberRegExp = /^\d+$/;
const integerNumberRegExp = /^-?\d+$/;
const invalidZoomMessage = function (zoom) {
return `Invalid zoom value (${zoom}). It should be an integer number greather than or equal to 0`;
};
const invalidCoordXMessage = function (x) {
return `Invalid coodinate 'x' value (${x}). It should be an integer number`;
};
const invalidCoordYMessage = function (y) {
return `Invalid coodinate 'y' value (${y}). It should be an integer number greather than or equal to 0`;
};
module.exports = function coordinates (validate = { z: true, x: true, y: true }) {
return function coordinatesMiddleware (req, res, next) {
const { z, x, y } = req.params;
if (validate.z && !positiveIntegerNumberRegExp.test(z)) {
const err = new Error(invalidZoomMessage(z));
err.http_status = 400;
return next(err);
}
// Negative values for x param are valid. The x param is wrapped
if (validate.x && !integerNumberRegExp.test(x)) {
const err = new Error(invalidCoordXMessage(x));
err.http_status = 400;
return next(err);
}
if (validate.y && !positiveIntegerNumberRegExp.test(y)) {
const err = new Error(invalidCoordYMessage(y));
err.http_status = 400;
return next(err);
}
next();
};
};

View File

@@ -0,0 +1,24 @@
'use strict';
module.exports = function cors () {
return function corsMiddleware (req, res, next) {
const headers = [
'X-Requested-With',
'X-Prototype-Version',
'X-CSRF-Token',
'Authorization',
'Carto-Event',
'Carto-Event-Source',
'Carto-Event-Group-Id'
];
if (req.method === 'OPTIONS') {
headers.push('Content-Type');
}
res.set('Access-Control-Allow-Origin', '*');
res.set('Access-Control-Allow-Headers', headers.join(', '));
next();
};
};

View File

@@ -0,0 +1,87 @@
'use strict';
const basicAuth = require('basic-auth');
module.exports = function credentials () {
return function credentialsMiddleware (req, res, next) {
const apikeyCredentials = getApikeyCredentialsFromRequest(req);
res.locals.api_key = apikeyCredentials.token;
res.locals.basicAuthUsername = apikeyCredentials.username;
res.set('vary', 'Authorization'); // Honor Authorization header when caching.
return next();
};
};
function getApikeyCredentialsFromRequest (req) {
let apikeyCredentials = {
token: null,
username: null
};
for (const getter of apikeyGetters) {
apikeyCredentials = getter(req);
if (apikeyTokenFound(apikeyCredentials)) {
break;
}
}
return apikeyCredentials;
}
const apikeyGetters = [
getApikeyTokenFromHeaderAuthorization,
getApikeyTokenFromRequestQueryString,
getApikeyTokenFromRequestBody
];
function getApikeyTokenFromHeaderAuthorization (req) {
const credentials = basicAuth(req);
if (credentials) {
return {
username: credentials.username,
token: credentials.pass
};
} else {
return {
username: null,
token: null
};
}
}
function getApikeyTokenFromRequestQueryString (req) {
let token = null;
if (req.query && req.query.api_key) {
token = req.query.api_key;
} else if (req.query && req.query.map_key) {
token = req.query.map_key;
}
return {
username: null,
token: token
};
}
function getApikeyTokenFromRequestBody (req) {
let token = null;
if (req.body && req.body.api_key) {
token = req.body.api_key;
} else if (req.body && req.body.map_key) {
token = req.body.map_key;
}
return {
username: null,
token: token
};
}
function apikeyTokenFound (apikey) {
return !!apikey && !!apikey.token;
}

View File

@@ -0,0 +1,30 @@
'use strict';
const _ = require('underscore');
module.exports = function dbConnSetup (pgConnection) {
return function dbConnSetupMiddleware (req, res, next) {
const { user } = res.locals;
pgConnection.setDBConn(user, res.locals, (err) => {
if (err) {
if (err.message && err.message.indexOf('name not found') !== -1) {
err.http_status = 404;
}
return next(err);
}
_.defaults(res.locals, {
dbuser: global.environment.postgres.user,
dbpassword: global.environment.postgres.password,
dbhost: global.environment.postgres.host,
dbport: global.environment.postgres.port
});
res.set('X-Served-By-DB-Host', res.locals.dbhost);
next();
});
};
};

View File

@@ -0,0 +1,172 @@
'use strict';
const setCommonHeaders = require('../../utils/common-headers');
module.exports = function errorMiddleware (/* options */) {
return function error (err, req, res, next) {
const { logger } = res.locals;
const errors = populateLimitErrors(Array.isArray(err) ? err : [err]);
errors.forEach((err) => logger.error({ exception: err }, 'Error while handling the request'));
setCommonHeaders(req, res, () => {
const errorResponseBody = {
errors: errors.map(errorMessage),
errors_with_context: errors.map(errorMessageWithContext)
};
// If a callback was requested, force status to 200
res.status(req.query.callback ? 200 : findStatusCode(errors[0]));
if (req.query && req.query.callback) {
res.jsonp(errorResponseBody);
} else {
res.json(errorResponseBody);
}
return next();
});
};
};
function isRenderTimeoutError (err) {
return err.message === 'Render timed out';
}
function isDatasourceTimeoutError (err) {
return err.message && err.message.match(/canceling statement due to statement timeout/i);
}
function isTimeoutError (errorTypes) {
return errorTypes.renderTimeoutError || errorTypes.datasourceTimeoutError;
}
function getErrorTypes (error) {
return {
renderTimeoutError: isRenderTimeoutError(error),
datasourceTimeoutError: isDatasourceTimeoutError(error)
};
}
function isMaxWaitingClientsError (err) {
return err.message === 'max waitingClients count exceeded';
}
function populateLimitErrors (errors) {
return errors.map(function (error) {
if (isMaxWaitingClientsError(error)) {
error.message = 'You are over platform\'s limits: Max render capacity exceeded.' +
' Contact CARTO support for more details.';
error.type = 'limit';
error.subtype = 'render-capacity';
error.http_status = 429;
return error;
}
const errorTypes = getErrorTypes(error);
if (isTimeoutError(errorTypes)) {
error.message = 'You are over platform\'s limits. Please contact us to know more details';
error.type = 'limit';
error.http_status = 429;
}
if (errorTypes.datasourceTimeoutError) {
error.subtype = 'datasource';
error.message = 'You are over platform\'s limits: SQL query timeout error.' +
' Refactor your query before running again or contact CARTO support for more details.';
}
if (errorTypes.renderTimeoutError) {
error.subtype = 'render';
error.message = 'You are over platform\'s limits: Render timeout error.' +
' Contact CARTO support for more details.';
}
return error;
});
}
function findStatusCode (err) {
var statusCode;
if (err.http_status) {
statusCode = err.http_status;
} else {
statusCode = statusFromErrorMessage('' + err);
}
return statusCode;
}
module.exports.findStatusCode = findStatusCode;
function statusFromErrorMessage (errMsg) {
// Find an appropriate statusCode based on message
var statusCode = 400;
if (errMsg.indexOf('permission denied') !== -1) {
statusCode = 403;
} else if (errMsg.indexOf('authentication failed') !== -1) {
statusCode = 403;
} else if (errMsg.match(/Postgis Plugin.*[\s|\n].*column.*does not exist/)) {
statusCode = 400;
} else if (errMsg.indexOf('does not exist') !== -1) {
if (errMsg.indexOf(' role ') !== -1) {
statusCode = 403; // role 'xxx' does not exist
} else if (errMsg.match(/function .* does not exist/)) {
statusCode = 400; // invalid SQL (SQL function does not exist)
} else {
statusCode = 404;
}
}
return statusCode;
}
function errorMessage (err) {
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/68
var message = (typeof err === 'string' ? err : err.message) || 'Unknown error';
return stripConnectionInfo(message);
}
module.exports.errorMessage = errorMessage;
function stripConnectionInfo (message) {
// Strip connection info, if any
return message
// See https://github.com/CartoDB/Windshaft/issues/173
.replace(/Connection string: '[^']*'\n\s/im, '')
// See https://travis-ci.org/CartoDB/Windshaft/jobs/20703062#L1644
.replace(/is the server.*encountered/im, 'encountered');
}
var ERROR_INFO_TO_EXPOSE = {
message: true,
layer: true,
type: true,
analysis: true,
subtype: true
};
function shouldBeExposed (prop) {
return !!ERROR_INFO_TO_EXPOSE[prop];
}
function errorMessageWithContext (err) {
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/68
var message = (typeof err === 'string' ? err : err.message) || 'Unknown error';
var error = {
type: err.type || 'unknown',
message: stripConnectionInfo(message)
};
for (var prop in err) {
// type & message are properties from Error's prototype and will be skipped
if (Object.prototype.hasOwnProperty.call(err, prop) && shouldBeExposed(prop)) {
error[prop] = err[prop];
}
}
return error;
}

View File

@@ -0,0 +1,16 @@
'use strict';
module.exports = function incrementMapViewCount (metadataBackend) {
return function incrementMapViewCountMiddleware (req, res, next) {
const { mapConfig, user, logger } = res.locals;
const statTag = mapConfig.obj().stat_tag;
metadataBackend.incMapviewCount(user, statTag, (err) => {
if (err) {
logger.warn({ exception: err }, 'Failed to increment mapview count');
}
next();
});
};
};

View File

@@ -0,0 +1,11 @@
'use strict';
module.exports = function initializeStatusCode () {
return function initializeStatusCodeMiddleware (req, res, next) {
if (req.method !== 'OPTIONS') {
res.statusCode = 404;
}
next();
};
};

View File

@@ -0,0 +1,44 @@
'use strict';
module.exports = function setLastModifiedHeader () {
return function setLastModifiedHeaderMiddleware (req, res, next) {
if (req.method !== 'GET') {
return next();
}
const { mapConfigProvider, cache_buster: cacheBuster, logger } = res.locals;
if (cacheBuster) {
const cacheBusterTimestamp = parseInt(cacheBuster, 10);
const lastModifiedDate = Number.isFinite(cacheBusterTimestamp) && cacheBusterTimestamp !== 0
? new Date(cacheBusterTimestamp)
: new Date();
res.set('Last-Modified', lastModifiedDate.toUTCString());
return next();
}
mapConfigProvider.getAffectedTables((err, affectedTables) => {
if (err) {
logger.warn({ exception: err }, 'Error generating Last Modified Header');
return next();
}
if (!affectedTables) {
res.set('Last-Modified', new Date().toUTCString());
return next();
}
const lastUpdatedAt = affectedTables.getLastUpdatedAt();
const lastModifiedDate = Number.isFinite(lastUpdatedAt) ? new Date(lastUpdatedAt) : new Date();
res.set('Last-Modified', lastModifiedDate.toUTCString());
res.locals.cache_buster = lastUpdatedAt;
next();
});
};
};

View File

@@ -0,0 +1,47 @@
'use strict';
module.exports = function setLastUpdatedTimeToLayergroup () {
return function setLastUpdatedTimeToLayergroupMiddleware (req, res, next) {
const { mapConfigProvider, analysesResults } = res.locals;
const layergroup = res.body;
mapConfigProvider.createAffectedTables((err, affectedTables) => {
if (err) {
return next(err);
}
if (!affectedTables) {
res.locals.cache_buster = 0;
layergroup.layergroupid = `${layergroup.layergroupid}:${res.locals.cache_buster}`;
layergroup.last_updated = new Date(res.locals.cache_buster).toISOString();
return next();
}
var lastUpdateTime = affectedTables.getLastUpdatedAt();
lastUpdateTime = getLastUpdatedTime(analysesResults, lastUpdateTime) || lastUpdateTime;
// last update for layergroup cache buster
layergroup.layergroupid = layergroup.layergroupid + ':' + lastUpdateTime;
layergroup.last_updated = new Date(lastUpdateTime).toISOString();
res.locals.cache_buster = lastUpdateTime;
next();
});
};
};
function getLastUpdatedTime (analysesResults, lastUpdateTime) {
if (!Array.isArray(analysesResults)) {
return lastUpdateTime;
}
return analysesResults.reduce(function (lastUpdateTime, analysis) {
return analysis.getNodes().reduce(function (lastNodeUpdatedAtTime, node) {
var nodeUpdatedAtDate = node.getUpdatedAt();
var nodeUpdatedTimeAt = (nodeUpdatedAtDate && nodeUpdatedAtDate.getTime()) || 0;
return nodeUpdatedTimeAt > lastNodeUpdatedAtTime ? nodeUpdatedTimeAt : lastNodeUpdatedAtTime;
}, lastUpdateTime);
}, lastUpdateTime);
}

View File

@@ -0,0 +1,28 @@
'use strict';
module.exports = function setLayerStats (pgConnection, statsBackend) {
return function setLayerStatsMiddleware (req, res, next) {
const { user, mapConfig } = res.locals;
const layergroup = res.body;
pgConnection.getConnection(user, (err, connection) => {
if (err) {
return next(err);
}
statsBackend.getStats(mapConfig, connection, function (err, layersStats) {
if (err) {
return next(err);
}
if (layersStats.length > 0) {
layergroup.metadata.layers.forEach(function (layer, index) {
layer.meta.stats = layersStats[index];
});
}
next();
});
});
};
};

View File

@@ -0,0 +1,18 @@
'use strict';
module.exports = function setLayergroupIdHeader (templateMaps, useTemplateHash) {
return function setLayergroupIdHeaderMiddleware (req, res, next) {
const { user, template } = res.locals;
const layergroup = res.body;
if (useTemplateHash) {
const templateHash = templateMaps.fingerPrint(template).substring(0, 8);
layergroup.layergroupid = `${user}@${templateHash}@${layergroup.layergroupid}`;
res.locals.templateHash = templateHash;
}
res.set('X-Layergroup-Id', layergroup.layergroupid);
next();
};
};

View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = function setMetadataToLayergroup (layergroupMetadata, includeQuery) {
return function setMetadataToLayergroupMiddleware (req, res, next) {
const { user, mapConfig, analysesResults = [], context, api_key: userApiKey } = res.locals;
const layergroup = res.body;
layergroupMetadata.addDataviewsAndWidgetsUrls(user, layergroup, mapConfig.obj());
layergroupMetadata.addAnalysesMetadata(user, layergroup, analysesResults, includeQuery);
layergroupMetadata.addTurboCartoContextMetadata(layergroup, mapConfig.obj(), context);
layergroupMetadata.addAggregationContextMetadata(layergroup, mapConfig.obj(), context);
layergroupMetadata.addDateWrappingMetadata(layergroup, mapConfig.obj());
layergroupMetadata.addTileJsonMetadata(layergroup, user, mapConfig, userApiKey);
next();
};
};

View File

@@ -0,0 +1,34 @@
'use strict';
const LayergroupToken = require('../../models/layergroup-token');
const authErrorMessageTemplate = function (signer, user) {
return `Cannot use map signature of user "${signer}" on db of user "${user}"`;
};
module.exports = function layergroupToken () {
return function layergroupTokenMiddleware (req, res, next) {
const user = res.locals.user;
const layergroupToken = LayergroupToken.parse(req.params.token);
res.locals.token = layergroupToken.token;
res.locals.cache_buster = layergroupToken.cacheBuster;
if (layergroupToken.templateHash) {
res.locals.templateHash = layergroupToken.templateHash;
}
if (layergroupToken.signer) {
res.locals.signer = layergroupToken.signer;
if (res.locals.signer !== user) {
const err = new Error(authErrorMessageTemplate(res.locals.signer, user));
err.type = 'auth';
err.http_status = (req.query && req.query.callback) ? 200 : 403;
return next(err);
}
}
return next();
};
};

View File

@@ -0,0 +1,12 @@
'use strict';
const uuid = require('uuid');
module.exports = function initLogger ({ logger }) {
return function initLoggerMiddleware (req, res, next) {
res.locals.logger = logger.child({ request_id: req.get('X-Request-Id') || uuid.v4(), 'cdb-user': res.locals.user });
res.locals.logger.info({ client_request: req }, 'Incoming request');
res.on('finish', () => res.locals.logger.info({ server_response: res, status: res.statusCode }, 'Response sent'));
next();
};
};

View File

@@ -0,0 +1,33 @@
'use strict';
const LZMA = require('lzma').LZMA;
module.exports = function lzma () {
const lzmaWorker = new LZMA();
return function lzmaMiddleware (req, res, next) {
if (!Object.prototype.hasOwnProperty.call(req.query, 'lzma')) {
return next();
}
// Decode (from base64)
var lzma = Buffer.from(req.query.lzma, 'base64')
.toString('binary')
.split('')
.map(function (c) {
return c.charCodeAt(0) - 128;
});
// Decompress
lzmaWorker.decompress(lzma, function (result) {
try {
delete req.query.lzma;
Object.assign(req.query, JSON.parse(result));
next();
} catch (err) {
next(new Error('Error parsing lzma as JSON: ' + err));
}
});
};
};

View File

@@ -0,0 +1,36 @@
'use strict';
module.exports = function mapError (options) {
const { addContext = false, label = 'MAPS CONTROLLER' } = options;
return function mapErrorMiddleware (err, req, res, next) {
const { mapConfig } = res.locals;
if (addContext) {
err = Number.isFinite(err.layerIndex) ? populateError(err, mapConfig) : err;
}
err.label = label;
next(err);
};
};
function populateError (err, mapConfig) {
var error = new Error(err.message);
error.http_status = err.http_status;
if (!err.http_status && err.message.indexOf('column "the_geom_webmercator" does not exist') >= 0) {
error.http_status = 400;
}
error.type = 'layer';
error.subtype = err.message.indexOf('Postgis Plugin') >= 0 ? 'query' : undefined;
error.layer = {
id: mapConfig.getLayerId(err.layerIndex),
index: err.layerIndex,
type: mapConfig.layerType(err.layerIndex)
};
return error;
}

View File

@@ -0,0 +1,52 @@
'use strict';
const MapStoreMapConfigProvider = require('../../models/mapconfig/provider/map-store-provider');
module.exports = function createMapStoreMapConfigProvider (
mapStore,
userLimitsBackend,
pgConnection,
affectedTablesCache,
forcedFormat = null
) {
return function createMapStoreMapConfigProviderMiddleware (req, res, next) {
const { user, token, cache_buster: cacheBuster, api_key: apiKey } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { layer: layerFromParams, z, x, y, scale_factor: scaleFactor, format } = req.params;
const { layer: layerFromQuery } = req.query;
const params = {
user,
token,
cache_buster: cacheBuster,
api_key: apiKey,
dbuser,
dbname,
dbpassword,
dbhost,
dbport,
layer: (layerFromQuery || layerFromParams),
z,
x,
y,
scale_factor: scaleFactor,
format
};
if (forcedFormat) {
params.format = forcedFormat;
params.layer = params.layer || 'all';
}
res.locals.mapConfigProvider = new MapStoreMapConfigProvider(
mapStore,
user,
userLimitsBackend,
pgConnection,
affectedTablesCache,
params
);
next();
};
};

View File

@@ -0,0 +1,181 @@
'use strict';
const EVENT_VERSION = '1';
const MAX_LENGTH = 100;
module.exports = function metrics ({ enabled, tags, metricsBackend }) {
if (!enabled) {
return function metricsDisabledMiddleware (req, res, next) {
next();
};
}
if (!tags || !tags.event) {
throw new Error('Missing required "event" parameter to report metrics');
}
return function metricsMiddleware (req, res, next) {
// FIXME: use parent logger as we don't want bind the error to the request
// but we still want to know if an error is thrown
const { logger } = res.locals;
res.on('finish', () => {
const { event, attributes } = getEventData(req, res, tags);
metricsBackend.send(event, attributes)
.catch((err) => logger.error({ exception: err, event }, 'Failed to publish event'));
});
return next();
};
};
function getEventData (req, res, tags) {
const event = tags.event;
const extra = {};
if (tags.from) {
if (tags.from.req) {
Object.assign(extra, getFromReq(req, tags.from.req));
}
if (tags.from.res) {
Object.assign(extra, getFromRes(res, tags.from.res));
}
}
const attributes = Object.assign({}, {
client_event: normalizedField(req.get('Carto-Event')),
client_event_group_id: normalizedField(req.get('Carto-Event-Group-Id')),
event_source: normalizedField(req.get('Carto-Event-Source')),
event_time: new Date().toISOString(),
user_id: res.locals.userId,
user_agent: req.get('User-Agent'),
map_id: getLayergroupid({ res }),
cache_buster: getCacheBuster({ res }),
template_hash: getTemplateHash({ res }),
stat_tag: getStatTag({ res }),
response_code: res.statusCode.toString(),
response_time: getResponseTime(req),
source_domain: req.hostname,
event_version: EVENT_VERSION
}, tags.attributes, extra);
// remove undefined properties
Object.keys(attributes).forEach(key => attributes[key] === undefined && delete attributes[key]);
return { event, attributes };
}
function normalizedField (field) {
if (!field) {
return undefined;
}
return field.toString().trim().substr(0, MAX_LENGTH);
}
function getLayergroupid ({ res }) {
if (res.locals.token) {
return res.locals.token;
}
if (res.locals.mapConfig) {
return res.locals.mapConfig.id();
}
if (res.locals.mapConfigProvider && res.locals.mapConfigProvider.mapConfig) {
return res.locals.mapConfigProvider.mapConfig.id();
}
}
function getCacheBuster ({ res }) {
if (res.locals.cache_buster !== undefined) {
return `${res.locals.cache_buster}`;
}
if (res.locals.mapConfigProvider) {
return `${res.locals.mapConfigProvider.getCacheBuster()}`;
}
}
function getTemplateHash ({ res }) {
if (res.locals.templateHash) {
return res.locals.templateHash;
}
if (res.locals.mapConfigProvider && res.locals.mapConfigProvider.getTemplateHash) {
let templateHash;
try {
templateHash = res.locals.mapConfigProvider.getTemplateHash().substring(0, 8);
} catch (e) {}
return templateHash;
}
}
function getStatTag ({ res }) {
if (res.locals.mapConfig) {
return res.locals.mapConfig.obj().stat_tag;
}
// FIXME: don't expect that mapConfig is already set
if (res.locals.mapConfigProvider && res.locals.mapConfigProvider.mapConfig) {
return res.locals.mapConfigProvider.mapConfig.obj().stat_tag;
}
}
// FIXME: 'Profiler' might not be accurate enough
function getResponseTime (req) {
let stats;
try {
stats = req.profiler.toJSON();
} catch (e) {
return undefined;
}
return stats && stats.total ? stats.total.toString() : undefined;
}
function getFromReq (req, { query = {}, body = {}, params = {}, headers = {} } = {}) {
const extra = {};
for (const [queryParam, eventName] of Object.entries(query)) {
extra[eventName] = req.query[queryParam];
}
for (const [bodyParam, eventName] of Object.entries(body)) {
extra[eventName] = req.body[bodyParam];
}
for (const [pathParam, eventName] of Object.entries(params)) {
extra[eventName] = req.params[pathParam];
}
for (const [header, eventName] of Object.entries(headers)) {
extra[eventName] = req.get(header);
}
return extra;
}
function getFromRes (res, { body = {}, headers = {}, locals = {} } = {}) {
const extra = {};
if (res.body) {
for (const [bodyParam, eventName] of Object.entries(body)) {
extra[eventName] = res.body[bodyParam];
}
}
for (const [header, eventName] of Object.entries(headers)) {
extra[eventName] = res.get(header);
}
for (const [localParam, eventName] of Object.entries(locals)) {
extra[eventName] = res.locals[localParam];
}
return extra;
}

View File

@@ -0,0 +1,46 @@
'use strict';
module.exports = function getNamedMapProvider ({ namedMapProviderCache, label, forcedFormat = null }) {
return function getNamedMapProviderMiddleware (req, res, next) {
const { user, token, cache_buster: cacheBuster, api_key: apiKey } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { template_id: templateId, layer: layerFromParams, z, x, y, format } = req.params;
const { layer: layerFromQuery } = req.query;
const params = {
user,
token,
cache_buster: cacheBuster,
api_key: apiKey,
dbuser,
dbname,
dbpassword,
dbhost,
dbport,
template_id: templateId,
layer: (layerFromQuery || layerFromParams),
z,
x,
y,
format
};
if (forcedFormat) {
params.format = forcedFormat;
params.layer = params.layer || 'all';
}
const { config, auth_token: authToken } = req.query;
namedMapProviderCache.get(user, templateId, config, authToken, params, (err, namedMapProvider) => {
if (err) {
err.label = label;
return next(err);
}
res.locals.mapConfigProvider = namedMapProvider;
next();
});
};
};

View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function noop () {
return function noopMiddleware (req, res, next) {
next();
};
};

View File

@@ -0,0 +1,37 @@
'use strict';
const Profiler = require('../../stats/profiler-proxy');
const debug = require('debug')('windshaft:cartodb:stats');
const { name: prefix } = require('../../../package.json');
module.exports = function profiler (options) {
const { enabled = true, statsClient } = options;
return function profilerMiddleware (req, res, next) {
const { logger } = res.locals;
// TODO: stop using profiler and log stats instead of adding them to the profiler
req.profiler = new Profiler({
statsd_client: statsClient,
profile: enabled
});
req.profiler.start(prefix);
res.on('finish', () => {
req.profiler.done('response');
req.profiler.end();
const stats = req.profiler.toJSON();
logger.info({ stats, duration: stats.response / 1000, duration_ms: stats.response }, 'Request profiling stats');
try {
// May throw due to dns, see: http://github.com/CartoDB/Windshaft/issues/166
req.profiler.sendStats();
} catch (err) {
debug('error sending profiling stats: ' + err);
}
});
next();
};
};

View File

@@ -0,0 +1,71 @@
'use strict';
const RATE_LIMIT_ENDPOINTS_GROUPS = {
ANONYMOUS: 'anonymous',
STATIC: 'static',
STATIC_NAMED: 'static_named',
DATAVIEW: 'dataview',
DATAVIEW_SEARCH: 'dataview_search',
ANALYSIS: 'analysis',
ANALYSIS_CATALOG: 'analysis_catalog',
TILE: 'tile',
ATTRIBUTES: 'attributes',
NAMED_LIST: 'named_list',
NAMED_CREATE: 'named_create',
NAMED_GET: 'named_get',
NAMED: 'named',
NAMED_UPDATE: 'named_update',
NAMED_DELETE: 'named_delete',
NAMED_TILES: 'named_tiles'
};
function rateLimit (userLimitsBackend, endpointGroup = null) {
if (!isRateLimitEnabled(endpointGroup)) {
return function rateLimitDisabledMiddleware (req, res, next) { next(); };
}
return function rateLimitMiddleware (req, res, next) {
userLimitsBackend.getRateLimit(res.locals.user, endpointGroup, function (err, userRateLimit) {
if (err) {
return next(err);
}
if (!userRateLimit) {
return next();
}
const [isBlocked, limit, remaining, retry, reset] = userRateLimit;
res.set({
'Carto-Rate-Limit-Limit': limit,
'Carto-Rate-Limit-Remaining': remaining,
'Carto-Rate-Limit-Reset': reset
});
if (isBlocked) {
// retry is floor rounded in seconds by redis-cell
res.set('Retry-After', retry + 1);
const rateLimitError = new Error(
'You are over platform\'s limits: too many requests.' +
' Please contact us to know more details'
);
rateLimitError.http_status = 429;
rateLimitError.type = 'limit';
rateLimitError.subtype = 'rate-limit';
return next(rateLimitError);
}
return next();
});
};
}
function isRateLimitEnabled (endpointGroup) {
return global.environment.enabledFeatures.rateLimitsEnabled &&
endpointGroup &&
global.environment.enabledFeatures.rateLimitsByEndpoint[endpointGroup];
}
module.exports = rateLimit;
module.exports.RATE_LIMIT_ENDPOINTS_GROUPS = RATE_LIMIT_ENDPOINTS_GROUPS;

View File

@@ -0,0 +1,24 @@
'use strict';
const setCommonHeaders = require('../../utils/common-headers');
module.exports = function sendResponse () {
return function sendResponseMiddleware (req, res, next) {
setCommonHeaders(req, res, () => {
res.status(res.statusCode);
if (Buffer.isBuffer(res.body)) {
res.send(res.body);
return next();
}
if (req.query.callback) {
res.jsonp(res.body);
return next();
}
res.json(res.body);
return next();
});
};
};

View File

@@ -0,0 +1,13 @@
'use strict';
const os = require('os');
module.exports = function servedByHostHeader () {
const hostname = os.hostname().split('.')[0];
return function servedByHostHeaderMiddleware (req, res, next) {
res.set('X-Served-By-Host', hostname);
next();
};
};

View File

@@ -0,0 +1,33 @@
'use strict';
const NamedMapsCacheEntry = require('../../cache/model/named-maps-entry');
const NamedMapMapConfigProvider = require('../../models/mapconfig/provider/named-map-provider');
module.exports = function setSurrogateKeyHeader ({ surrogateKeysCache }) {
return function setSurrogateKeyHeaderMiddleware (req, res, next) {
const { user, mapConfigProvider, logger } = res.locals;
if (mapConfigProvider instanceof NamedMapMapConfigProvider) {
surrogateKeysCache.tag(res, new NamedMapsCacheEntry(user, mapConfigProvider.getTemplateName()));
}
if (req.method !== 'GET') {
return next();
}
mapConfigProvider.getAffectedTables((err, affectedTables) => {
if (err) {
logger.warn({ exception: err }, 'Error generating Surrogate Key Header');
return next();
}
if (!affectedTables || !affectedTables.tables || affectedTables.tables.length === 0) {
return next();
}
surrogateKeysCache.tag(res, affectedTables);
next();
});
};
};

View File

@@ -0,0 +1,12 @@
'use strict';
module.exports = function syntaxError () {
return function syntaxErrorMiddleware (err, req, res, next) {
if (err.name === 'SyntaxError') {
err.http_status = 400;
err.message = `${err.name}: ${err.message}`;
}
next(err);
};
};

View File

@@ -0,0 +1,15 @@
'use strict';
module.exports = function tag ({ tags }) {
if (!Array.isArray(tags) || !tags.every((tag) => typeof tag === 'string')) {
throw new Error('Required "tags" option must be a valid Array: [string, string, ...]');
}
return function tagMiddleware (req, res, next) {
const { logger } = res.locals;
res.locals.tags = tags;
res.on('finish', () => logger.info({ tags: res.locals.tags }, 'Request tagged'));
next();
};
};

View File

@@ -0,0 +1,29 @@
'use strict';
const CdbRequest = require('../../models/cdb-request');
module.exports = function user (metadataBackend) {
const cdbRequest = new CdbRequest();
return function userMiddleware (req, res, next) {
try {
res.locals.user = getUserNameFromRequest(req, cdbRequest);
} catch (err) {
return next(err);
}
metadataBackend.getUserId(res.locals.user, (err, userId) => {
if (err || !userId) {
return next();
}
res.locals.userId = userId;
return next();
});
};
};
function getUserNameFromRequest (req, cdbRequest) {
return cdbRequest.userByReq(req);
}

View File

@@ -0,0 +1,34 @@
'use strict';
const fs = require('fs');
const path = require('path');
const timeoutErrorVectorTile = fs.readFileSync(path.join(__dirname, '/../../../assets/render-timeout-fallback.mvt'));
module.exports = function vectorError () {
return function vectorErrorMiddleware (err, req, res, next) {
if (req.params.format === 'mvt') {
if (isTimeoutError(err) || isRateLimitError(err)) {
res.set('Content-Type', 'application/x-protobuf');
return res.status(429).send(timeoutErrorVectorTile);
}
}
next(err);
};
};
function isRenderTimeoutError (err) {
return err.message === 'Render timed out';
}
function isDatasourceTimeoutError (err) {
return err.message && err.message.match(/canceling statement due to statement timeout/i);
}
function isTimeoutError (err) {
return isRenderTimeoutError(err) || isDatasourceTimeoutError(err);
}
function isRateLimitError (err) {
return err.type === 'limit' && err.subtype === 'rate-limit';
}

View File

@@ -0,0 +1,229 @@
'use strict';
const { templateName } = require('../../backends/template-maps');
const tag = require('../middlewares/tag');
const credentials = require('../middlewares/credentials');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
module.exports = class AdminTemplateController {
/**
* @param {AuthBackend} authBackend
* @param {PgConnection} pgConnection
* @param {TemplateMaps} templateMaps
* @constructor
*/
constructor (authBackend, templateMaps, userLimitsBackend) {
this.authBackend = authBackend;
this.templateMaps = templateMaps;
this.userLimitsBackend = userLimitsBackend;
}
route (templateRouter) {
templateRouter.options('/:template_id');
templateRouter.post('/', this.middlewares({
action: 'create',
label: 'POST TEMPLATE',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_CREATE
}));
templateRouter.put('/:template_id', this.middlewares({
action: 'update',
label: 'PUT TEMPLATE',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_UPDATE
}));
templateRouter.get('/:template_id', this.middlewares({
action: 'get',
label: 'GET TEMPLATE',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_GET
}));
templateRouter.delete('/:template_id', this.middlewares({
action: 'delete',
label: 'DELETE TEMPLATE',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_DELETE
}));
templateRouter.get('/', this.middlewares({
action: 'list',
label: 'GET TEMPLATE LIST',
rateLimitGroup: RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_LIST
}));
}
middlewares ({ action, label, rateLimitGroup }) {
let template;
if (action === 'create') {
template = createTemplate;
}
if (action === 'update') {
template = updateTemplate;
}
if (action === 'get') {
template = retrieveTemplate;
}
if (action === 'delete') {
template = destroyTemplate;
}
if (action === 'list') {
template = listTemplates;
}
return [
tag({ tags: ['named', 'admin', action] }),
credentials(),
authorizedByAPIKey({ authBackend: this.authBackend, action, label }),
rateLimit(this.userLimitsBackend, rateLimitGroup),
checkContentType({ action: 'POST', label: 'POST TEMPLATE' }),
template({ templateMaps: this.templateMaps })
];
}
};
function checkContentType ({ label }) {
return function checkContentTypeMiddleware (req, res, next) {
if ((req.method === 'POST' || req.method === 'PUT') && !req.is('application/json')) {
const error = new Error(`${req.method} template data must be of type application/json`);
error.label = label;
return next(error);
}
next();
};
}
function authorizedByAPIKey ({ authBackend, action, label }) {
return function authorizedByAPIKeyMiddleware (req, res, next) {
const { user } = res.locals;
authBackend.authorizedByAPIKey(user, res, (err, authenticated, apikey) => {
if (err) {
return next(err);
}
if (!authenticated) {
const error = new Error(`Only authenticated users can ${action} templated maps`);
error.http_status = 403;
error.label = label;
return next(error);
}
if (apikey.type !== 'master') {
const error = new Error('Forbidden');
error.type = 'auth';
error.subtype = 'api-key-does-not-grant-access';
error.http_status = 403;
return next(error);
}
next();
});
};
}
function createTemplate ({ templateMaps }) {
return function createTemplateMiddleware (req, res, next) {
const { user } = res.locals;
const template = req.body;
templateMaps.addTemplate(user, template, (err, templateId) => {
if (err) {
return next(err);
}
res.statusCode = 200;
res.body = { template_id: templateId };
next();
});
};
}
function updateTemplate ({ templateMaps }) {
return function updateTemplateMiddleware (req, res, next) {
const { user } = res.locals;
const template = req.body;
const templateId = templateName(req.params.template_id);
templateMaps.updTemplate(user, templateId, template, (err) => {
if (err) {
return next(err);
}
res.statusCode = 200;
res.body = { template_id: templateId };
next();
});
};
}
function retrieveTemplate ({ templateMaps }) {
return function retrieveTemplateMiddleware (req, res, next) {
const { user } = res.locals;
const templateId = templateName(req.params.template_id);
templateMaps.getTemplate(user, templateId, (err, template) => {
if (err) {
return next(err);
}
if (!template) {
const error = new Error(`Cannot find template '${templateId}' of user '${user}'`);
error.http_status = 404;
return next(error);
}
// auth_id was added by ourselves,
// so we remove it before returning to the user
delete template.auth_id;
res.statusCode = 200;
res.body = { template };
next();
});
};
}
function destroyTemplate ({ templateMaps }) {
return function destroyTemplateMiddleware (req, res, next) {
const { user } = res.locals;
const templateId = templateName(req.params.template_id);
templateMaps.delTemplate(user, templateId, (err/* , tpl_val */) => {
if (err) {
return next(err);
}
res.statusCode = 204;
res.body = '';
next();
});
};
}
function listTemplates ({ templateMaps }) {
return function listTemplatesMiddleware (req, res, next) {
const { user } = res.locals;
templateMaps.listTemplates(user, (err, templateIds) => {
if (err) {
return next(err);
}
res.statusCode = 200;
res.body = { template_ids: templateIds };
next();
});
};
}

View File

@@ -0,0 +1,235 @@
'use strict';
const tag = require('../middlewares/tag');
const cleanUpQueryParams = require('../middlewares/clean-up-query-params');
const credentials = require('../middlewares/credentials');
const dbConnSetup = require('../middlewares/db-conn-setup');
const authorize = require('../middlewares/authorize');
const checkJsonContentType = require('../middlewares/check-json-content-type');
const incrementMapViewCount = require('../middlewares/increment-map-view-count');
const augmentLayergroupData = require('../middlewares/augment-layergroup-data');
const cacheControlHeader = require('../middlewares/cache-control-header');
const cacheChannelHeader = require('../middlewares/cache-channel-header');
const surrogateKeyHeader = require('../middlewares/surrogate-key-header');
const lastModifiedHeader = require('../middlewares/last-modified-header');
const lastUpdatedTimeLayergroup = require('../middlewares/last-updated-time-layergroup');
const layerStats = require('../middlewares/layer-stats');
const layergroupIdHeader = require('../middlewares/layergroup-id-header');
const layergroupMetadata = require('../middlewares/layergroup-metadata');
const mapError = require('../middlewares/map-error');
const NamedMapMapConfigProvider = require('../../models/mapconfig/provider/named-map-provider');
const CreateLayergroupMapConfigProvider = require('../../models/mapconfig/provider/create-layergroup-provider');
const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const metrics = require('../middlewares/metrics');
module.exports = class NamedMapController {
/**
* @param {PgConnection} pgConnection
* @param {TemplateMaps} templateMaps
* @param {MapBackend} mapBackend
* @param metadataBackend
* @param {SurrogateKeysCache} surrogateKeysCache
* @param {UserLimitsBackend} userLimitsBackend
* @param {LayergroupAffectedTables} layergroupAffectedTables
* @param {MapConfigAdapter} mapConfigAdapter
* @param {StatsBackend} statsBackend
* @param {AuthBackend} authBackend
* @param layergroupMetadata
* @constructor
*/
constructor (
config,
pgConnection,
templateMaps,
mapBackend,
metadataBackend,
surrogateKeysCache,
userLimitsBackend,
layergroupAffectedTables,
mapConfigAdapter,
statsBackend,
authBackend,
layergroupMetadata,
metricsBackend
) {
this.config = config;
this.pgConnection = pgConnection;
this.templateMaps = templateMaps;
this.mapBackend = mapBackend;
this.metadataBackend = metadataBackend;
this.surrogateKeysCache = surrogateKeysCache;
this.userLimitsBackend = userLimitsBackend;
this.layergroupAffectedTables = layergroupAffectedTables;
this.mapConfigAdapter = mapConfigAdapter;
this.statsBackend = statsBackend;
this.authBackend = authBackend;
this.layergroupMetadata = layergroupMetadata;
this.metricsBackend = metricsBackend;
}
route (templateRouter) {
templateRouter.get('/:template_id/jsonp', this.middlewares());
templateRouter.post('/:template_id', this.middlewares());
}
middlewares () {
const useTemplateHash = true;
const includeQuery = false;
const label = 'NAMED MAP LAYERGROUP';
const addContext = false;
const metricsTags = {
event: 'map_view',
attributes: { map_type: 'named' },
from: {
req: {
query: { client: 'client' }
}
}
};
return [
tag({ tags: ['map', 'named'] }),
metrics({
enabled: this.config.pubSubMetrics.enabled,
metricsBackend: this.metricsBackend,
tags: metricsTags
}),
credentials(),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED),
cleanUpQueryParams(['aggregation']),
checkJsonContentType(),
checkInstantiteLayergroup(),
getTemplate(
this.templateMaps,
this.pgConnection,
this.metadataBackend,
this.userLimitsBackend,
this.mapConfigAdapter,
this.layergroupAffectedTables
),
instantiateLayergroup(
this.mapBackend,
this.userLimitsBackend,
this.pgConnection,
this.layergroupAffectedTables
),
incrementMapViewCount(this.metadataBackend),
augmentLayergroupData(),
cacheControlHeader({ ttl: global.environment.varnish.layergroupTtl || 86400, revalidate: true }),
cacheChannelHeader(),
surrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
lastModifiedHeader(),
lastUpdatedTimeLayergroup(),
layerStats(this.pgConnection, this.statsBackend),
layergroupIdHeader(this.templateMaps, useTemplateHash),
layergroupMetadata(this.layergroupMetadata, includeQuery),
mapError({ label, addContext })
];
}
};
function checkInstantiteLayergroup () {
return function checkInstantiteLayergroupMiddleware (req, res, next) {
if (req.method === 'GET') {
const { callback, config } = req.query;
if (callback === undefined || callback.length === 0) {
return next(new Error('callback parameter should be present and be a function name'));
}
if (config) {
try {
req.body = JSON.parse(config);
} catch (e) {
return next(new Error('Invalid config parameter, should be a valid JSON'));
}
}
}
return next();
};
}
function getTemplate (
templateMaps,
pgConnection,
metadataBackend,
userLimitsBackend,
mapConfigAdapter,
affectedTablesCache
) {
return function getTemplateMiddleware (req, res, next) {
const templateParams = req.body;
const { user, dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { template_id: templateId } = req.params;
const { auth_token: authToken } = req.query;
const params = Object.assign({ dbuser, dbname, dbpassword, dbhost, dbport }, req.query);
const mapConfigProvider = new NamedMapMapConfigProvider(
templateMaps,
pgConnection,
metadataBackend,
userLimitsBackend,
mapConfigAdapter,
affectedTablesCache,
user,
templateId,
templateParams,
authToken,
params
);
mapConfigProvider.logger = res.locals.logger;
mapConfigProvider.getMapConfig((err, mapConfig, rendererParams, context, stats = {}) => {
req.profiler.add(stats);
if (err) {
return next(err);
}
res.locals.mapConfig = mapConfig;
res.locals.rendererParams = rendererParams;
res.locals.mapConfigProvider = mapConfigProvider;
next();
});
};
}
function instantiateLayergroup (mapBackend, userLimitsBackend, pgConnection, affectedTablesCache) {
return function instantiateLayergroupMiddleware (req, res, next) {
const { user, mapConfig, rendererParams } = res.locals;
const mapConfigProvider = new CreateLayergroupMapConfigProvider(
mapConfig,
user,
userLimitsBackend,
pgConnection,
affectedTablesCache,
rendererParams
);
mapBackend.createLayergroup(mapConfig, rendererParams, mapConfigProvider, (err, layergroup, stats = {}) => {
req.profiler.add(stats);
if (err) {
return next(err);
}
res.statusCode = 200;
res.body = layergroup;
const { mapConfigProvider } = res.locals;
res.locals.analysesResults = mapConfigProvider.analysesResults;
res.locals.template = mapConfigProvider.template;
res.locals.context = mapConfigProvider.context;
next();
});
};
}

View File

@@ -0,0 +1,76 @@
'use strict';
const { Router: router } = require('express');
const NamedMapController = require('./named-template-controller');
const AdminTemplateController = require('./admin-template-controller');
const TileTemplateController = require('./tile-template-controller');
module.exports = class TemplateRouter {
constructor ({ collaborators }) {
const {
config,
pgConnection,
templateMaps,
mapBackend,
metadataBackend,
surrogateKeysCache,
userLimitsBackend,
layergroupAffectedTablesCache,
mapConfigAdapter,
statsBackend,
authBackend,
layergroupMetadata,
namedMapProviderCache,
tileBackend,
metricsBackend
} = collaborators;
this.namedMapController = new NamedMapController(
config,
pgConnection,
templateMaps,
mapBackend,
metadataBackend,
surrogateKeysCache,
userLimitsBackend,
layergroupAffectedTablesCache,
mapConfigAdapter,
statsBackend,
authBackend,
layergroupMetadata,
metricsBackend
);
this.tileTemplateController = new TileTemplateController(
namedMapProviderCache,
tileBackend,
surrogateKeysCache,
pgConnection,
authBackend,
userLimitsBackend
);
this.adminTemplateController = new AdminTemplateController(
authBackend,
templateMaps,
userLimitsBackend
);
}
route (apiRouter, routes) {
const templateRouter = router({ mergeParams: true });
routes.forEach(route => {
const { paths, middlewares = [] } = route;
middlewares.forEach(middleware => templateRouter.use(middleware()));
this.namedMapController.route(templateRouter);
this.tileTemplateController.route(templateRouter);
this.adminTemplateController.route(templateRouter);
paths.forEach(path => apiRouter.use(path, templateRouter));
});
}
};

Some files were not shown because too many files have changed in this diff Show More