Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...(sqon ? [{ op: 'not', content: [sqon] }] : []),
],
},
},
})),
withProps(({ familyMemberWithoutParticipantIdAggregation: { data } }) => ({
familyMemberWithoutParticipantIds: (
get(data, 'file.aggregations.participants__family__family_members__kf_id.buckets') || []
).map(b => b.key),
})),
withProps(({ familyMemberIds, familyMemberWithoutParticipantIds }) => ({
finalFamilyMemberIds: familyMemberWithoutParticipantIds.length
? familyMemberWithoutParticipantIds
: familyMemberIds,
})),
withQuery(
({ sqon, projectId, finalFamilyMemberIds, familyMemberWithoutParticipantIdAggregation }) => ({
shouldFetch: !familyMemberWithoutParticipantIdAggregation.loading,
renderError: true,
projectId,
key: 'dataTypesAggregation',
query: `
query dataTypes($sqon: JSON) {
file {
aggregations(filters: $sqon) {
data_type {
buckets {
doc_count
key
}
}
}
content: { field: 'data_type', value: selectedDataTypes },
},
{
op: 'in',
content: { field: 'participants.kf_id', value: familyMemberIds },
},
],
},
],
}
: sqon;
};
const enhance = compose(
injectState,
withQuery(({ sqon, projectId }) => ({
renderError: true,
projectId,
key: 'familyMemberIdAggregation',
query: `
query dataTypes($sqon: JSON) {
file {
aggregations(filters: $sqon) {
participants__family__family_members__kf_id {
buckets {
doc_count
key
}
}
}
}
}
doc_count
key
}
}
}
}
}
`,
variables: { sqon },
})),
withProps(({ familyMemberIdAggregation: { data } }) => ({
familyMemberIds: (
get(data, 'file.aggregations.participants__family__family_members__kf_id.buckets') || []
).map(b => b.key),
})),
withQuery(({ sqon, projectId, familyMemberIds, familyMemberIdAggregation }) => ({
shouldFetch: !familyMemberIdAggregation.loading,
renderError: true,
projectId,
key: 'familyMemberWithoutParticipantIdAggregation',
query: `
query dataTypes($sqon: JSON) {
file {
aggregations(filters: $sqon) {
participants__family__family_members__kf_id {
buckets {
doc_count
key
}
}
}
}
render={props => {
const selectionSQON = props.selectedTableRows.length
? replaceSQON({
op: 'and',
content: [
{
op: 'in',
content: { field: 'kf_id', value: props.selectedTableRows },
},
],
})
: url.sqon;
return (