Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deserializeItemData(item) {
return {
...mapKeys(this._fieldsByPath, field => field.deserialize(item)),
// Handle the special case of `_label_` (and potentially others)
...omit(item, Object.keys(this._fieldsByPath)),
};
}
(idFilters.id_in && idFilters.id_in.length === 0) ||
// All the passed in ids have been explicitly disallowed
(idFilters.id_not_in && idFilters.id_not_in.length === uniqueIds.length)
) {
// NOTE: We don't throw an error for multi-actions, only return an empty
// array because there's no mechanism in GraphQL to return more than one
// error for a list result.
return [];
}
// NOTE: The fields will be filtered by the ACL checking in gqlFieldResolvers()
// NOTE: Unlike in the single-operation variation, there is no security risk
// in returning the result of the query here, because if no items match, we
// return an empty array regardless of if that's because of lack of
// permissions or because of those items don't exist.
const remainingAccess = omit(access, ['id', 'id_not', 'id_in', 'id_not_in']);
return await this._itemsQuery(
{ where: { ...remainingAccess, ...idFilters } },
{ context, info }
);
}
return list.fields.filter(({ isPrimaryKey }) => !isPrimaryKey).map(f => omit(f, ['options']));
};
async _processNonRealFields(data, processFunction) {
return resolveAllKeys(
arrayToObject(
Object.entries(omit(data, this.realKeys)).map(([path, value]) => ({
path,
value,
adapter: this.fieldAdaptersByPath[path],
})),
'path',
processFunction
)
);
}