Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get: function getterComputedQueries() {
// If dbsetup does not exist, throw Error!
if (!this.$dbsetup) throw new Error('[VuePouchDB] dbsetup does not exist!');
// Setting up the Queries
// TODO: memoize/cache this function
return (this.$bucket.state[this.$dbsetup.name] || []).filter(
sift(expand(queries[name], this) || {})
);
},
// When setting wait 500ms before executing the function
_validateWithRule(rule) {
// Clone where as we will be modifying the leaf nodes
let where = _.cloneDeep(rule.where);
// Fill the props
this._fillWhere(where);
// Validation failed?
let sifted = sift(where, [this._props]);
if (sifted.length > 0) {
return this._fillErrorProps(rule.error);
}
}
constructor(collection, query, options) {
this.collection = collection;
if (!query)
query = {};
if (!options)
options = {};
if (!options.includePendingDeletes)
query.__pendingDelete = { $exists: false };
this._query = query;
this.query = sift(query);
}
eligibleObjects = _.filter(this.parentObjects, object => {
return sift(this.metaFilters)(object[this.linkStorageField]);
});
}
update(idOrSelector, newDocOrChanges) {
if (typeof idOrSelector === 'string') {
return this._update(idOrSelector, newDocOrChanges);
} else if (typeof idOrSelector === 'object') {
const query = sift(idOrSelector);
const updatedDocIds = [];
let matchedCount = 0;
let modifiedCount = 0;
for (let [id, doc] of this.documents)
if (query(doc)) {
matchedCount++;
if (this._update(id, newDocOrChanges)) {
modifiedCount++;
updatedDocIds.push(id);
};
}
return {
matchedCount,
modifiedCount,
function Rule(params) {
classCallCheck(this, Rule);
this.conditions = params.conditions;
this.actions = params.actions;
this.subject = params.subject;
this.inverted = !!params.inverted;
this._matches = this.conditions ? sift(this.conditions) : null;
}
function getRequestData(request, params) {
const collection = storage[request.collection] || [];
let data = sift(params, collection);
if (request.params.$id) {
return data && data[0];
}
if (params.$skip || params.$limit) {
const skip = params.$skip || 0;
const limit = params.$limit ? skip + params.$limit : null;
data = data.slice(skip, limit);
}
return data;
}
type: 'included',
};
const inheritedPropertiesQuery = {
type: 'inherited',
};
const ownOrIncludedGroupsQuery = {
$or: [
ownPropertiesQuery,
includedPropertiesQuery,
],
};
const ownProperties = sift(ownPropertiesQuery, elementGroups);
const inheritedProperties = sift(inheritedPropertiesQuery, elementGroups);
const includedProperties = sift(includedPropertiesQuery, elementGroups);
const ownOrIncludedProperties = sift(ownOrIncludedGroupsQuery, elementGroups);
if (this.context.inheritedProperties === 'placeholder' &&
this.context.includedProperties === 'placeholder') {
return (
<div style="{this.style.root}">
{
map(inheritedProperties, (group, groupIndex) => (
{
group.components
}
))</div>
export function createManyMeta(object, fieldStorage, metaFilters) {
let value = object[fieldStorage];
if (metaFilters) {
value = sift(metaFilters, value)
}
return {
_id: {
$in: _.pluck(value, '_id') || []
}
};
}