lib/helpers.js
/**
 * flags:
 *  - REMOVE_NON_EQ_OP: remove non equality operators from partial entity e.g. GE, LE, BETWEEN...
 *  - USE_SECOND_OP_ARG: Use the second condition argument to build the partial entity if available e.g.
 *                       the second argument in the BETWEEN codnition, but the first in the LT condition
 *                       as LT has only one argument
 */
- REMOVE_NON_EQ_OP: remove non equality operators from partial entity e.g. GE, LE, BETWEEN
- USE_SECOND_OP_ARG: Use the second condition argument to build the partial entity if available e.g.
the second argument in the BETWEEN codnition, but the first in the LT condition
as LT has only one argument
- REMOVE_NON_EQ_OP : remove non equality operators from partial entity e . g . GE LE BETWEEN - USE_SECOND_OP_ARG : Use the second condition argument to build the partial entity if available e . g . the second argument in the BETWEEN codnition but the first in the LT condition as LT has only one argument
function buildPartialEntityFromFilter(filter, flags) {
    var _a, _b;
    var removeNonEQOp = (_a = flags === null || flags === void 0 ? void 0 : flags.includes('REMOVE_NON_EQ_OP')) !== null && _a !== void 0 ? _a : false;
    var useSecondOpArg = (_b = flags === null || flags === void 0 ? void 0 : flags.includes('USE_SECOND_OP_ARG')) !== null && _b !== void 0 ? _b : false;
    var entries = Object.entries(filter);
    var filteredEntries = entries.filter(function (_a) {
        var expr = _a[1];
        return !removeNonEQOp || expr[0] === 'EQ';
    });
    var preferentialArg = useSecondOpArg ? 2 : 1;
    var normalizedEntries = filteredEntries.map(function (e) { var _a; return [e[0], (_a = e[1][preferentialArg]) !== null && _a !== void 0 ? _a : e[1][1]]; });
    var partial = Object.fromEntries(normalizedEntries);
    return buildObjectFromPathMap(partial);
}
function buildPartialEntityFromFilter ( filter , flags ) { var _a , _b ; var removeNonEQOp = ( _a = flags === null || flags === void 0 ? void 0 : flags . includes ( 'REMOVE_NON_EQ_OP' ) ) !== null && _a !== void 0 ? _a : false ; var useSecondOpArg = ( _b = flags === null || flags === void 0 ? void 0 : flags . includes ( 'USE_SECOND_OP_ARG' ) ) !== null && _b !== void 0 ? _b : false ; var entries = Object . entries ( filter ) ; var filteredEntries = entries . filter ( function ( _a ) { var expr = _a [ 1 ] ; return ! removeNonEQOp || expr [ 0 ] === 'EQ' ; } ) ; var preferentialArg = useSecondOpArg ? 2 : 1 ; var normalizedEntries = filteredEntries . map ( function ( e ) { var _a ; return [ e [ 0 ] , ( _a = e [ 1 ] [ preferentialArg ] ) !== null && _a !== void 0 ? _a : e [ 1 ] [ 1 ] ] ; } ) ; var partial = Object . fromEntries ( normalizedEntries ) ; return buildObjectFromPathMap ( partial ) ; }
flags:
  - REMOVE_NON_EQ_OP: remove non equality operators from partial entity e.g.
flags : - REMOVE_NON_EQ_OP : remove non equality operators from partial entity e . g .