-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Branch] Aggregation 7 #6011
Conversation
Top Level aggregations in connections
… field projection filtered by aggregation
…s some types are shared
…ngesets Include deprecations for aggregation filters and changesets for the new aggregation filters
…ion-filters Make the new aggregation filters compliant with `@filterable` and `@relationship` directives.
Co-authored-by: MacondoExpress <simone.gammicchia@neotechnology.com>
Remove deprecated aggregation fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled test
graphql/packages/graphql/tests/integration/filtering/typename-in.int.test.ts
Lines 149 to 171 in 4329878
test.skip("aggregation", async () => { | |
const query = ` | |
{ | |
productionsConnection(where: { OR: [ { typename: [${Movie.name}, ${Series.name}] } { typename: [${Cartoon.name}] } ] }) { | |
aggregate { | |
count { | |
nodes | |
} | |
} | |
} | |
} | |
`; | |
const queryResult = await testHelper.executeGraphQL(query); | |
expect(queryResult.errors).toBeUndefined(); | |
expect(queryResult.data).toEqual({ | |
productionsConnection: { | |
count: { | |
nodes: 3, | |
}, | |
}, | |
}); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled test
graphql/packages/graphql/tests/integration/filtering/typename-in.int.test.ts
Lines 173 to 201 in 4329878
test.skip("nested aggregation", async () => { | |
const query = ` | |
{ | |
${Actor.plural} { | |
actedInConnection(where: { NOT: { typename: [${Movie.name}, ${Series.name}] } }) { | |
aggegate { | |
count { | |
nodes | |
} | |
} | |
} | |
} | |
} | |
`; | |
const queryResult = await testHelper.executeGraphQL(query); | |
expect(queryResult.errors).toBeUndefined(); | |
expect(queryResult.data).toEqual({ | |
[Actor.plural]: expect.arrayContaining([ | |
{ | |
actedInConnection: { | |
count: { | |
nodes: 1, | |
}, | |
}, | |
}, | |
]), | |
}); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled test
graphql/packages/graphql/tests/schema/directives/filterable.test.ts
Lines 30 to 89 in 4329878
test.skip("default arguments should disable aggregation", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @node { | |
username: String! | |
movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT) | |
} | |
type Movie @subscription @node { | |
title: String @filterable | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ | |
typeDefs, | |
features: { | |
subscriptions: new TestCDCEngine(), | |
excludeDeprecatedFields: { | |
aggregationFiltersOutsideConnection: true, | |
}, | |
}, | |
}); | |
const schema = await neoSchema.getSchema(); | |
const movieWhereType = schema.getType("MovieWhere") as GraphQLInputObjectType; | |
expect(movieWhereType).toBeDefined(); | |
const movieWhereFields = movieWhereType.getFields(); | |
expect(movieWhereFields.title).toBeDefined(); | |
expect(movieWhereFields.releaseDate).toBeDefined(); | |
const movieSubscriptionWhereType = schema.getType("MovieSubscriptionWhere") as GraphQLInputObjectType; | |
expect(movieSubscriptionWhereType).toBeDefined(); | |
const movieSubscriptionWhereFields = movieSubscriptionWhereType.getFields(); | |
const subscriptionTitle_EQ = movieSubscriptionWhereFields["title_EQ"]; | |
const subscriptionTitle_IN = movieSubscriptionWhereFields["title_IN"]; | |
const subscriptionTitle_CONTAINS = movieSubscriptionWhereFields["title_CONTAINS"]; | |
const subscriptionTitle_STARTS_WITH = movieSubscriptionWhereFields["title_STARTS_WITH"]; | |
const subscriptionTitle_ENDS_WITH = movieSubscriptionWhereFields["title_ENDS_WITH"]; | |
const subscriptionTitleFilters = [ | |
subscriptionTitle_EQ, | |
subscriptionTitle_IN, | |
subscriptionTitle_CONTAINS, | |
subscriptionTitle_STARTS_WITH, | |
subscriptionTitle_ENDS_WITH, | |
]; | |
for (const scalarFilter of subscriptionTitleFilters) { | |
expect(scalarFilter).toBeDefined(); | |
} | |
const aggregationWhereInput = schema.getType( | |
"ActorMoviesNodeAggregationWhereInput" | |
) as GraphQLInputObjectType; | |
expect(aggregationWhereInput).toBeUndefined(); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled test
graphql/packages/graphql/tests/schema/directives/filterable.test.ts
Lines 92 to 163 in 4329878
test.skip("enable value and aggregation filters", async () => { | |
const typeDefs = gql` | |
type Actor @node { | |
username: String! | |
password: String! | |
movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT) | |
} | |
type Movie @subscription @node { | |
title: String @filterable(byValue: true, byAggregate: true) | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ | |
typeDefs, | |
features: { | |
subscriptions: new TestCDCEngine(), | |
}, | |
}); | |
const schema = await neoSchema.getSchema(); | |
const movieWhereType = schema.getType("MovieWhere") as GraphQLInputObjectType; | |
expect(movieWhereType).toBeDefined(); | |
const movieWhereFields = movieWhereType.getFields(); | |
const title_EQ = movieWhereFields["title_EQ"]; | |
const title_IN = movieWhereFields["title_IN"]; | |
const title_CONTAINS = movieWhereFields["title_CONTAINS"]; | |
const title_STARTS_WITH = movieWhereFields["title_STARTS_WITH"]; | |
const title_ENDS_WITH = movieWhereFields["title_ENDS_WITH"]; | |
const titleFilters = [title_EQ, title_IN, title_CONTAINS, title_STARTS_WITH, title_ENDS_WITH]; | |
for (const scalarFilter of titleFilters) { | |
expect(scalarFilter).toBeDefined(); | |
} | |
const movieSubscriptionWhereType = schema.getType("MovieSubscriptionWhere") as GraphQLInputObjectType; | |
expect(movieSubscriptionWhereType).toBeDefined(); | |
const movieSubscriptionWhereFields = movieSubscriptionWhereType.getFields(); | |
const subscriptionTitle_EQ = movieSubscriptionWhereFields["title_EQ"]; | |
const subscriptionTitle_IN = movieSubscriptionWhereFields["title_IN"]; | |
const subscriptionTitle_CONTAINS = movieSubscriptionWhereFields["title_CONTAINS"]; | |
const subscriptionTitle_STARTS_WITH = movieSubscriptionWhereFields["title_STARTS_WITH"]; | |
const subscriptionTitle_ENDS_WITH = movieSubscriptionWhereFields["title_ENDS_WITH"]; | |
const subscriptionTitleFilters = [ | |
subscriptionTitle_EQ, | |
subscriptionTitle_IN, | |
subscriptionTitle_CONTAINS, | |
subscriptionTitle_STARTS_WITH, | |
subscriptionTitle_ENDS_WITH, | |
]; | |
for (const scalarFilter of subscriptionTitleFilters) { | |
expect(scalarFilter).toBeDefined(); | |
} | |
const aggregationWhereInput = schema.getType( | |
"ActorMoviesNodeAggregationWhereInput" | |
) as GraphQLInputObjectType; | |
expect(aggregationWhereInput).toBeDefined(); | |
const aggregationWhereInputFields = aggregationWhereInput.getFields(); | |
const title_AGG = aggregationWhereInputFields["title"]; | |
expect(title_AGG).toBeUndefined(); | |
}); |
Description
This is a feature branch of the breaking changes to aggregations in version 7.
This branch also contains the changes from #5945