Commit b254056c authored by Romain Courteaud's avatar Romain Courteaud

Release 3.34.0

Revert ERP5Storage local_roles handling breakage
parent 8b1427ac
...@@ -26,7 +26,7 @@ TESTDIR = test ...@@ -26,7 +26,7 @@ TESTDIR = test
EXAMPLEDIR = examples EXAMPLEDIR = examples
EXTERNALDIR = external EXTERNALDIR = external
VERSION = 3.33.0 VERSION = 3.34.0
JIOVERSION = ${DISTDIR}/jio-v${VERSION}.js JIOVERSION = ${DISTDIR}/jio-v${VERSION}.js
JIOLATEST = ${DISTDIR}/jio-latest.js JIOLATEST = ${DISTDIR}/jio-latest.js
JIONODEVERSION = ${DISTDIR}/jio-v${VERSION}-node.js JIONODEVERSION = ${DISTDIR}/jio-v${VERSION}-node.js
......
...@@ -7857,9 +7857,9 @@ var arrayExtend = function () { ...@@ -7857,9 +7857,9 @@ var arrayExtend = function () {
if (query.operator === "NOT") { if (query.operator === "NOT") {
return query.query_list[0]; return query.query_list[0];
} }
return {"type": "complex", "key": "", "operator": "NOT", "query_list": [query]}; return {"type": "complex", "operator": "NOT", "query_list": [query]};
}, mkComplexQuery = function (key, operator, query_list) { }, mkComplexQuery = function (operator, query_list) {
var i, query_list2 = []; var i, query_list2 = [];
for (i = 0; i < query_list.length; i += 1) { for (i = 0; i < query_list.length; i += 1) {
if (query_list[i].operator === operator) { if (query_list[i].operator === operator) {
...@@ -7868,10 +7868,17 @@ var arrayExtend = function () { ...@@ -7868,10 +7868,17 @@ var arrayExtend = function () {
query_list2.push(query_list[i]); query_list2.push(query_list[i]);
} }
} }
return {type:"complex",key:key,operator:operator,query_list:query_list2}; return {type:"complex",operator:operator,query_list:query_list2};
}, querySetKey = function (query, key) { }, simpleQuerySetKey = function (query, key) {
if (({simple: 1, complex: 1})[query.type] && !query.key) { var i;
if (query.type === "complex") {
for (i = 0; i < query.query_list.length; ++i) {
simpleQuerySetKey (query.query_list[i],key);
}
return true;
}
if (query.type === "simple" && !query.key) {
query.key = key; query.key = key;
return true; return true;
} }
...@@ -7973,13 +7980,13 @@ case 5: case 8: case 11: case 14: case 16: ...@@ -7973,13 +7980,13 @@ case 5: case 8: case 11: case 14: case 16:
this.$ = $$[$0]; this.$ = $$[$0];
break; break;
case 6: case 6:
this.$ = mkComplexQuery('', 'AND', [$$[$0-1], $$[$0]]); this.$ = mkComplexQuery('AND', [$$[$0-1], $$[$0]]);
break; break;
case 7: case 7:
this.$ = mkComplexQuery('', 'OR', [$$[$0-2], $$[$0]]); this.$ = mkComplexQuery('OR', [$$[$0-2], $$[$0]]);
break; break;
case 9: case 9:
this.$ = mkComplexQuery('', 'AND', [$$[$0-2], $$[$0]]); this.$ = mkComplexQuery('AND', [$$[$0-2], $$[$0]]);
break; break;
case 10: case 10:
this.$ = mkNotQuery($$[$0]); this.$ = mkNotQuery($$[$0]);
...@@ -7988,7 +7995,7 @@ case 12: ...@@ -7988,7 +7995,7 @@ case 12:
this.$ = $$[$0-1]; this.$ = $$[$0-1];
break; break;
case 13: case 13:
querySetKey($$[$0], $$[$0-2]); this.$ = $$[$0]; simpleQuerySetKey($$[$0], $$[$0-2]); this.$ = $$[$0];
break; break;
case 15: case 15:
$$[$0].operator = $$[$0-1] ; this.$ = $$[$0]; $$[$0].operator = $$[$0-1] ; this.$ = $$[$0];
...@@ -9082,8 +9089,6 @@ return new Parser; ...@@ -9082,8 +9089,6 @@ return new Parser;
*/ */
this.operator = spec.operator; this.operator = spec.operator;
this.key = spec.key || this.key;
/** /**
* The sub Query list which are used to query an item. * The sub Query list which are used to query an item.
* *
...@@ -9103,7 +9108,6 @@ return new Parser; ...@@ -9103,7 +9108,6 @@ return new Parser;
ComplexQuery.prototype.operator = "AND"; ComplexQuery.prototype.operator = "AND";
ComplexQuery.prototype.type = "complex"; ComplexQuery.prototype.type = "complex";
ComplexQuery.prototype.key = "";
/** /**
* #crossLink "Query/match:method" * #crossLink "Query/match:method"
...@@ -9120,8 +9124,21 @@ return new Parser; ...@@ -9120,8 +9124,21 @@ return new Parser;
* #crossLink "Query/toString:method" * #crossLink "Query/toString:method"
*/ */
ComplexQuery.prototype.toString = function () { ComplexQuery.prototype.toString = function () {
/*global objectToSearchText */ var str_list = [], this_operator = this.operator;
return objectToSearchText(this.toJSON()); if (this.operator === "NOT") {
str_list.push("NOT (");
str_list.push(this.query_list[0].toString());
str_list.push(")");
return str_list.join(" ");
}
this.query_list.forEach(function (query) {
str_list.push("(");
str_list.push(query.toString());
str_list.push(")");
str_list.push(this_operator);
});
str_list.length -= 1;
return str_list.join(" ");
}; };
/** /**
...@@ -9131,7 +9148,6 @@ return new Parser; ...@@ -9131,7 +9148,6 @@ return new Parser;
var s = { var s = {
"type": "complex", "type": "complex",
"operator": this.operator, "operator": this.operator,
"key": this.key,
"query_list": [] "query_list": []
}; };
this.query_list.forEach(function (query) { this.query_list.forEach(function (query) {
...@@ -9221,26 +9237,12 @@ return new Parser; ...@@ -9221,26 +9237,12 @@ return new Parser;
}; };
function objectToSearchText(query) { function objectToSearchText(query) {
var str_list = [], operator = "", query_list = null; var str_list = [];
if (query.type === "complex") { if (query.type === "complex") {
query_list = query.query_list || [];
if (query_list.length === 0) {
return "";
}
operator = query.operator;
if (operator === "NOT") {
str_list.push("NOT");
// fallback to AND operator if several queries are given
// i.e. `NOT ( a AND b )`
operator = "AND";
}
if (query.key) {
str_list.push(query.key + ":");
}
str_list.push("("); str_list.push("(");
query_list.forEach(function (sub_query) { (query.query_list || []).forEach(function (sub_query) {
str_list.push(objectToSearchText(sub_query)); str_list.push(objectToSearchText(sub_query));
str_list.push(operator); str_list.push(query.operator);
}); });
str_list.length -= 1; str_list.length -= 1;
str_list.push(")"); str_list.push(")");
...@@ -9417,7 +9419,8 @@ return new Parser; ...@@ -9417,7 +9419,8 @@ return new Parser;
* #crossLink "Query/toString:method" * #crossLink "Query/toString:method"
*/ */
SimpleQuery.prototype.toString = function () { SimpleQuery.prototype.toString = function () {
return objectToSearchText(this.toJSON()); return (this.key ? this.key + ":" : "") +
(this.operator ? " " + this.operator : "") + ' "' + this.value + '"';
}; };
/** /**
......
...@@ -6079,9 +6079,9 @@ var arrayExtend = function () { ...@@ -6079,9 +6079,9 @@ var arrayExtend = function () {
if (query.operator === "NOT") { if (query.operator === "NOT") {
return query.query_list[0]; return query.query_list[0];
} }
return {"type": "complex", "key": "", "operator": "NOT", "query_list": [query]}; return {"type": "complex", "operator": "NOT", "query_list": [query]};
}, mkComplexQuery = function (key, operator, query_list) { }, mkComplexQuery = function (operator, query_list) {
var i, query_list2 = []; var i, query_list2 = [];
for (i = 0; i < query_list.length; i += 1) { for (i = 0; i < query_list.length; i += 1) {
if (query_list[i].operator === operator) { if (query_list[i].operator === operator) {
...@@ -6090,10 +6090,17 @@ var arrayExtend = function () { ...@@ -6090,10 +6090,17 @@ var arrayExtend = function () {
query_list2.push(query_list[i]); query_list2.push(query_list[i]);
} }
} }
return {type:"complex",key:key,operator:operator,query_list:query_list2}; return {type:"complex",operator:operator,query_list:query_list2};
}, querySetKey = function (query, key) { }, simpleQuerySetKey = function (query, key) {
if (({simple: 1, complex: 1})[query.type] && !query.key) { var i;
if (query.type === "complex") {
for (i = 0; i < query.query_list.length; ++i) {
simpleQuerySetKey (query.query_list[i],key);
}
return true;
}
if (query.type === "simple" && !query.key) {
query.key = key; query.key = key;
return true; return true;
} }
...@@ -6195,13 +6202,13 @@ case 5: case 8: case 11: case 14: case 16: ...@@ -6195,13 +6202,13 @@ case 5: case 8: case 11: case 14: case 16:
this.$ = $$[$0]; this.$ = $$[$0];
break; break;
case 6: case 6:
this.$ = mkComplexQuery('', 'AND', [$$[$0-1], $$[$0]]); this.$ = mkComplexQuery('AND', [$$[$0-1], $$[$0]]);
break; break;
case 7: case 7:
this.$ = mkComplexQuery('', 'OR', [$$[$0-2], $$[$0]]); this.$ = mkComplexQuery('OR', [$$[$0-2], $$[$0]]);
break; break;
case 9: case 9:
this.$ = mkComplexQuery('', 'AND', [$$[$0-2], $$[$0]]); this.$ = mkComplexQuery('AND', [$$[$0-2], $$[$0]]);
break; break;
case 10: case 10:
this.$ = mkNotQuery($$[$0]); this.$ = mkNotQuery($$[$0]);
...@@ -6210,7 +6217,7 @@ case 12: ...@@ -6210,7 +6217,7 @@ case 12:
this.$ = $$[$0-1]; this.$ = $$[$0-1];
break; break;
case 13: case 13:
querySetKey($$[$0], $$[$0-2]); this.$ = $$[$0]; simpleQuerySetKey($$[$0], $$[$0-2]); this.$ = $$[$0];
break; break;
case 15: case 15:
$$[$0].operator = $$[$0-1] ; this.$ = $$[$0]; $$[$0].operator = $$[$0-1] ; this.$ = $$[$0];
...@@ -7304,8 +7311,6 @@ return new Parser; ...@@ -7304,8 +7311,6 @@ return new Parser;
*/ */
this.operator = spec.operator; this.operator = spec.operator;
this.key = spec.key || this.key;
/** /**
* The sub Query list which are used to query an item. * The sub Query list which are used to query an item.
* *
...@@ -7325,7 +7330,6 @@ return new Parser; ...@@ -7325,7 +7330,6 @@ return new Parser;
ComplexQuery.prototype.operator = "AND"; ComplexQuery.prototype.operator = "AND";
ComplexQuery.prototype.type = "complex"; ComplexQuery.prototype.type = "complex";
ComplexQuery.prototype.key = "";
/** /**
* #crossLink "Query/match:method" * #crossLink "Query/match:method"
...@@ -7342,8 +7346,21 @@ return new Parser; ...@@ -7342,8 +7346,21 @@ return new Parser;
* #crossLink "Query/toString:method" * #crossLink "Query/toString:method"
*/ */
ComplexQuery.prototype.toString = function () { ComplexQuery.prototype.toString = function () {
/*global objectToSearchText */ var str_list = [], this_operator = this.operator;
return objectToSearchText(this.toJSON()); if (this.operator === "NOT") {
str_list.push("NOT (");
str_list.push(this.query_list[0].toString());
str_list.push(")");
return str_list.join(" ");
}
this.query_list.forEach(function (query) {
str_list.push("(");
str_list.push(query.toString());
str_list.push(")");
str_list.push(this_operator);
});
str_list.length -= 1;
return str_list.join(" ");
}; };
/** /**
...@@ -7353,7 +7370,6 @@ return new Parser; ...@@ -7353,7 +7370,6 @@ return new Parser;
var s = { var s = {
"type": "complex", "type": "complex",
"operator": this.operator, "operator": this.operator,
"key": this.key,
"query_list": [] "query_list": []
}; };
this.query_list.forEach(function (query) { this.query_list.forEach(function (query) {
...@@ -7443,26 +7459,12 @@ return new Parser; ...@@ -7443,26 +7459,12 @@ return new Parser;
}; };
function objectToSearchText(query) { function objectToSearchText(query) {
var str_list = [], operator = "", query_list = null; var str_list = [];
if (query.type === "complex") { if (query.type === "complex") {
query_list = query.query_list || [];
if (query_list.length === 0) {
return "";
}
operator = query.operator;
if (operator === "NOT") {
str_list.push("NOT");
// fallback to AND operator if several queries are given
// i.e. `NOT ( a AND b )`
operator = "AND";
}
if (query.key) {
str_list.push(query.key + ":");
}
str_list.push("("); str_list.push("(");
query_list.forEach(function (sub_query) { (query.query_list || []).forEach(function (sub_query) {
str_list.push(objectToSearchText(sub_query)); str_list.push(objectToSearchText(sub_query));
str_list.push(operator); str_list.push(query.operator);
}); });
str_list.length -= 1; str_list.length -= 1;
str_list.push(")"); str_list.push(")");
...@@ -7639,7 +7641,8 @@ return new Parser; ...@@ -7639,7 +7641,8 @@ return new Parser;
* #crossLink "Query/toString:method" * #crossLink "Query/toString:method"
*/ */
SimpleQuery.prototype.toString = function () { SimpleQuery.prototype.toString = function () {
return objectToSearchText(this.toJSON()); return (this.key ? this.key + ":" : "") +
(this.operator ? " " + this.operator : "") + ' "' + this.value + '"';
}; };
/** /**
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "@nexedi/jio", "name": "@nexedi/jio",
"version": "v3.33.0", "version": "v3.34.0",
"license": "GPLv3+", "license": "GPLv3+",
"author": "Nexedi SA", "author": "Nexedi SA",
"contributors": [ "contributors": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment