Use develop branch of query-tables
This commit is contained in:
parent
f7707141d6
commit
c4054f0ac9
@ -34,15 +34,12 @@ module.exports = class BaseMapConfigProvider {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
queryTables.getQueryMetadataModel(connection, sql, (err, affectedTables) => {
|
queryTables.getQueryMetadataModel(connection, sql)
|
||||||
if (err) {
|
.then(affectedTables => {
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.affectedTablesCache.set(dbname, token, affectedTables);
|
this.affectedTablesCache.set(dbname, token, affectedTables);
|
||||||
|
|
||||||
callback(null, affectedTables);
|
callback(null, affectedTables);
|
||||||
});
|
})
|
||||||
|
.catch(err => callback(err));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
51
package-lock.json
generated
51
package-lock.json
generated
@ -166,7 +166,7 @@
|
|||||||
},
|
},
|
||||||
"async": {
|
"async": {
|
||||||
"version": "1.5.2",
|
"version": "1.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
|
"resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz",
|
||||||
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
|
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
|
||||||
},
|
},
|
||||||
"asynckit": {
|
"asynckit": {
|
||||||
@ -427,9 +427,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cartodb-query-tables": {
|
"cartodb-query-tables": {
|
||||||
"version": "0.6.3",
|
"version": "github:cartodb/node-cartodb-query-tables#ea2734da8f3c6d1c37e48f438f2bb8d1c5c832b5",
|
||||||
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.6.3.tgz",
|
"from": "github:cartodb/node-cartodb-query-tables#coherent-ttl-refactor",
|
||||||
"integrity": "sha512-ijHl2Roh+0B1pP8SL3guEAu8tE6yNN3J/oxdUWCFOSKjHmXjwTzyJdjO+tONGcERmlWfS594SCFYElGIweSnQg==",
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"decimal.js": "10.2.0"
|
"decimal.js": "10.2.0"
|
||||||
}
|
}
|
||||||
@ -812,7 +811,7 @@
|
|||||||
},
|
},
|
||||||
"entities": {
|
"entities": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz",
|
"resolved": "http://registry.npmjs.org/entities/-/entities-1.0.0.tgz",
|
||||||
"integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=",
|
"integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -826,7 +825,7 @@
|
|||||||
},
|
},
|
||||||
"es6-promise": {
|
"es6-promise": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.1.2.tgz",
|
"resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.1.2.tgz",
|
||||||
"integrity": "sha1-eV4lzrR/e6uyY9FRr77dktGOagc="
|
"integrity": "sha1-eV4lzrR/e6uyY9FRr77dktGOagc="
|
||||||
},
|
},
|
||||||
"escape-html": {
|
"escape-html": {
|
||||||
@ -914,7 +913,7 @@
|
|||||||
},
|
},
|
||||||
"express": {
|
"express": {
|
||||||
"version": "4.16.3",
|
"version": "4.16.3",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
"resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
||||||
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"accepts": "~1.3.5",
|
"accepts": "~1.3.5",
|
||||||
@ -1037,7 +1036,7 @@
|
|||||||
},
|
},
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
|
"resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
|
||||||
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
|
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
|
||||||
},
|
},
|
||||||
"fast-json-stable-stringify": {
|
"fast-json-stable-stringify": {
|
||||||
@ -1066,7 +1065,7 @@
|
|||||||
},
|
},
|
||||||
"finalhandler": {
|
"finalhandler": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
"resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
||||||
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
|
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
@ -2008,7 +2007,7 @@
|
|||||||
},
|
},
|
||||||
"get-stream": {
|
"get-stream": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
"resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
||||||
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
|
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
|
||||||
},
|
},
|
||||||
"getpass": {
|
"getpass": {
|
||||||
@ -2229,7 +2228,7 @@
|
|||||||
},
|
},
|
||||||
"htmlparser2": {
|
"htmlparser2": {
|
||||||
"version": "3.8.3",
|
"version": "3.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz",
|
"resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz",
|
||||||
"integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=",
|
"integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -2242,7 +2241,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "1.1.14",
|
"version": "1.1.14",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
||||||
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -2256,7 +2255,7 @@
|
|||||||
},
|
},
|
||||||
"http-errors": {
|
"http-errors": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||||
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"depd": "~1.1.2",
|
"depd": "~1.1.2",
|
||||||
@ -2580,12 +2579,12 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": {
|
"async": {
|
||||||
"version": "0.2.10",
|
"version": "0.2.10",
|
||||||
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
|
"resolved": "http://registry.npmjs.org/async/-/async-0.2.10.tgz",
|
||||||
"integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E="
|
"integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E="
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "4.3.6",
|
"version": "4.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
|
"resolved": "http://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
|
||||||
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto="
|
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto="
|
||||||
},
|
},
|
||||||
"underscore": {
|
"underscore": {
|
||||||
@ -2620,7 +2619,7 @@
|
|||||||
},
|
},
|
||||||
"media-typer": {
|
"media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||||
},
|
},
|
||||||
"mem": {
|
"mem": {
|
||||||
@ -2706,7 +2705,7 @@
|
|||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
@ -2740,7 +2739,7 @@
|
|||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
"resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
@ -3238,7 +3237,7 @@
|
|||||||
},
|
},
|
||||||
"postcss": {
|
"postcss": {
|
||||||
"version": "5.0.19",
|
"version": "5.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-5.0.19.tgz",
|
"resolved": "http://registry.npmjs.org/postcss/-/postcss-5.0.19.tgz",
|
||||||
"integrity": "sha1-tjQqAdx1uMq36Wiv2pau/Gf4iK8=",
|
"integrity": "sha1-tjQqAdx1uMq36Wiv2pau/Gf4iK8=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"js-base64": "^2.1.9",
|
"js-base64": "^2.1.9",
|
||||||
@ -3277,7 +3276,7 @@
|
|||||||
},
|
},
|
||||||
"postcss-value-parser": {
|
"postcss-value-parser": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz",
|
"resolved": "http://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz",
|
||||||
"integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU="
|
"integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU="
|
||||||
},
|
},
|
||||||
"postgres-array": {
|
"postgres-array": {
|
||||||
@ -3404,7 +3403,7 @@
|
|||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "1.0.34",
|
"version": "1.0.34",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-util-is": "~1.0.0",
|
"core-util-is": "~1.0.0",
|
||||||
@ -3780,7 +3779,7 @@
|
|||||||
},
|
},
|
||||||
"strip-ansi": {
|
"strip-ansi": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
@ -3796,7 +3795,7 @@
|
|||||||
},
|
},
|
||||||
"strip-eof": {
|
"strip-eof": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
"resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||||
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
|
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
|
||||||
},
|
},
|
||||||
"strip-json-comments": {
|
"strip-json-comments": {
|
||||||
@ -3840,7 +3839,7 @@
|
|||||||
},
|
},
|
||||||
"through": {
|
"through": {
|
||||||
"version": "2.3.8",
|
"version": "2.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||||
},
|
},
|
||||||
"torque.js": {
|
"torque.js": {
|
||||||
@ -4067,7 +4066,7 @@
|
|||||||
},
|
},
|
||||||
"wrap-ansi": {
|
"wrap-ansi": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||||
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"string-width": "^1.0.1",
|
"string-width": "^1.0.1",
|
||||||
@ -4096,7 +4095,7 @@
|
|||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "11.1.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
|
"resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
|
||||||
"integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==",
|
"integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cliui": "^4.0.0",
|
"cliui": "^4.0.0",
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"body-parser": "1.18.3",
|
"body-parser": "1.18.3",
|
||||||
"camshaft": "^0.64.2",
|
"camshaft": "^0.64.2",
|
||||||
"cartodb-psql": "0.14.0",
|
"cartodb-psql": "0.14.0",
|
||||||
"cartodb-query-tables": "^0.6.3",
|
"cartodb-query-tables": "github:cartodb/node-cartodb-query-tables#coherent-ttl-refactor",
|
||||||
"cartodb-redis": "2.1.0",
|
"cartodb-redis": "2.1.0",
|
||||||
"debug": "3.1.0",
|
"debug": "3.1.0",
|
||||||
"dot": "1.1.2",
|
"dot": "1.1.2",
|
||||||
|
@ -368,8 +368,8 @@ describe('tests from old api translated to multilayer', function() {
|
|||||||
keysToDelete['user:localhost:mapviews:global'] = 5;
|
keysToDelete['user:localhost:mapviews:global'] = 5;
|
||||||
|
|
||||||
var affectedFn = QueryTables.getQueryMetadataModel;
|
var affectedFn = QueryTables.getQueryMetadataModel;
|
||||||
QueryTables.getQueryMetadataModel = function(pg, sql, callback) {
|
QueryTables.getQueryMetadataModel = async function (pg, sql) {
|
||||||
return callback(new Error('fake error message'));
|
throw new Error('fake error message');
|
||||||
};
|
};
|
||||||
|
|
||||||
// reset internal cacheChannel cache
|
// reset internal cacheChannel cache
|
||||||
|
@ -32,10 +32,9 @@ describe('QueryTables', function() {
|
|||||||
|
|
||||||
// Check test/support/sql/windshaft.test.sql to understand where the values come from.
|
// Check test/support/sql/windshaft.test.sql to understand where the values come from.
|
||||||
|
|
||||||
it('should return an object with affected tables array and last updated time', function(done) {
|
it('should return an object with affected tables array and last updated time', async function () {
|
||||||
var query = 'select * from test_table';
|
var query = 'select * from test_table';
|
||||||
QueryTables.getQueryMetadataModel(connection, query, function(err, result) {
|
const result = await QueryTables.getQueryMetadataModel(connection, query);
|
||||||
assert.ok(!err, err);
|
|
||||||
|
|
||||||
assert.equal(result.getLastUpdatedAt(), 1234567890123);
|
assert.equal(result.getLastUpdatedAt(), 1234567890123);
|
||||||
|
|
||||||
@ -43,15 +42,11 @@ describe('QueryTables', function() {
|
|||||||
assert.equal(result.tables[0].dbname, 'test_windshaft_cartodb_user_1_db');
|
assert.equal(result.tables[0].dbname, 'test_windshaft_cartodb_user_1_db');
|
||||||
assert.equal(result.tables[0].schema_name, 'public');
|
assert.equal(result.tables[0].schema_name, 'public');
|
||||||
assert.equal(result.tables[0].table_name, 'test_table');
|
assert.equal(result.tables[0].table_name, 'test_table');
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work with private tables', function(done) {
|
it('should work with private tables', async function () {
|
||||||
var query = 'select * from test_table_private_1';
|
var query = 'select * from test_table_private_1';
|
||||||
QueryTables.getQueryMetadataModel(connection, query, function(err, result) {
|
const result = await QueryTables.getQueryMetadataModel(connection, query);
|
||||||
assert.ok(!err, err);
|
|
||||||
|
|
||||||
assert.equal(result.getLastUpdatedAt(), 1234567890123);
|
assert.equal(result.getLastUpdatedAt(), 1234567890123);
|
||||||
|
|
||||||
@ -59,9 +54,5 @@ describe('QueryTables', function() {
|
|||||||
assert.equal(result.tables[0].dbname, 'test_windshaft_cartodb_user_1_db');
|
assert.equal(result.tables[0].dbname, 'test_windshaft_cartodb_user_1_db');
|
||||||
assert.equal(result.tables[0].schema_name, 'public');
|
assert.equal(result.tables[0].schema_name, 'public');
|
||||||
assert.equal(result.tables[0].table_name, 'test_table_private_1');
|
assert.equal(result.tables[0].table_name, 'test_table_private_1');
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user