imports/vx/client/code/vxapp.js
/**
     * Apply filters to a standard publishing object. There are two types of filters: criteria or text.
     * Criteria filters are simply additional properties added to the criteria. Text filters leverage
     * Regex expressions to search text fields within the collection, and the caller must supply an
     * object such as { searchPhrase: "Aetna", propertyNames: [ "name", "description" ] }.
     *
     * @param {object} publish Standard publishing object.
     * @param {object} criteria Standard criteria filter is an object merged with publishing criteria.
     * @param {object} regexFilter Object representing regex filtering criteria { searchPhrase, propertyNames }.
     * @return {object} Standard publishing object adjusted with filters.
     */
Apply filters to a standard publishing object. There are two types of filters: criteria or text.
Criteria filters are simply additional properties added to the criteria.

@param {object} publish Standard publishing object.
@param {object} criteria Standard criteria filter is an object merged with publishing criteria.
@param {object} regexFilter Object representing regex filtering criteria { searchPhrase, propertyNames }.
@return {object} Standard publishing object adjusted with filters.
Apply filters to a standard publishing object . There are two types of filters : criteria or text . Criteria filters are simply additional properties added to the criteria . @param { object } publish Standard publishing object . @param { object } criteria Standard criteria filter is an object merged with publishing criteria . @param { object } regexFilter Object representing regex filtering criteria { searchPhrase propertyNames } . @return { object } Standard publishing object adjusted with filters .
applyFilters(publish, criteria, regexFilter) {
        const publishAdjusted = cloneDeep(publish)
        if (criteria) {
            publishAdjusted.criteria = { ...publish.criteria, ...criteria }
        }
        if (regexFilter) {
            const searchRegex = new RegExp(regexFilter.searchPhrase, "i")
            publishAdjusted.criteria.$or = []
            regexFilter.propertyNames.forEach(propertyName => {
                publishAdjusted.criteria.$or.push({ [propertyName]: searchRegex })
            })
        }
        return publishAdjusted
    }
applyFilters ( publish , criteria , regexFilter ) { const publishAdjusted = cloneDeep ( publish ) if ( criteria ) { publishAdjusted . criteria = { ... publish . criteria , ... criteria } } if ( regexFilter ) { const searchRegex = new RegExp ( regexFilter . searchPhrase , "i" ) publishAdjusted . criteria . $or = [ ] regexFilter . propertyNames . forEach ( propertyName => { publishAdjusted . criteria . $or . push ( { [ propertyName ] : searchRegex } ) } ) } return publishAdjusted }
Apply filters to a standard publishing object.
Apply filters to a standard publishing object .