* Adding a test demonstrating issue #1840. * Fixes #1840 * Adds failing test with other use case - That test fails on parse.com as well * Bumps parse to 1.9.0 * exclude pg db * Exclude pg on other test * Adds clientSDK compatibility check for forward deletion - Mark js1.9.0 as compatible * Strips all operations from result - fix for #1606
This commit is contained in:
40
src/ClientSDK.js
Normal file
40
src/ClientSDK.js
Normal file
@@ -0,0 +1,40 @@
|
||||
var semver = require('semver');
|
||||
|
||||
function compatible(compatibleSDK) {
|
||||
return function(clientSDK) {
|
||||
if (typeof clientSDK === 'string') {
|
||||
clientSDK = fromString(clientSDK);
|
||||
}
|
||||
// REST API, or custom SDK
|
||||
if (!clientSDK) {
|
||||
return true;
|
||||
}
|
||||
let clientVersion = clientSDK.version;
|
||||
let compatiblityVersion = compatibleSDK[clientSDK.sdk];
|
||||
return semver.satisfies(clientVersion, compatiblityVersion);
|
||||
}
|
||||
}
|
||||
|
||||
function supportsForwardDelete(clientSDK) {
|
||||
return compatible({
|
||||
js: '>=1.9.0'
|
||||
})(clientSDK);
|
||||
}
|
||||
|
||||
function fromString(version) {
|
||||
let versionRE = /([-a-zA-Z]+)([0-9\.]+)/;
|
||||
let match = version.toLowerCase().match(versionRE);
|
||||
if (match && match.length === 3) {
|
||||
return {
|
||||
sdk: match[1],
|
||||
version: match[2]
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
compatible,
|
||||
supportsForwardDelete,
|
||||
fromString
|
||||
}
|
||||
Reference in New Issue
Block a user