-
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
7.x #5767
base: dev
Are you sure you want to change the base?
7.x #5767
Conversation
🦋 Changeset detectedLatest commit: 5a4e23f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Remove deprecated aggregation fields
* Subscriptions as an opt-in feature * Remove inline await * Update tests
[Feature Branch] Aggregation 7
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 176 to 204 in e421830
test.skip("nested aggregation", async () => { | |
const query = ` | |
{ | |
${Actor.plural} { | |
actedInConnection(where: { NOT: { typename: [${Movie.name}, ${Series.name}] } }) { | |
aggregate { | |
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 e421830
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 e421830
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(); | |
}); |
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 suite
graphql/packages/graphql/tests/schema/directives/query.test.ts
Lines 25 to 159 in e421830
describe.skip("on OBJECT", () => { | |
test("default arguments should disable aggregation", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @node { | |
username: String! | |
password: String! | |
} | |
type Movie @query @node { | |
title: String | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const { movies, actors, moviesConnection, actorsConnection, moviesAggregate, actorsAggregate } = schema | |
.getQueryType() | |
?.getFields() as GraphQLFieldMap<any, any>; | |
expect(movies).toBeDefined(); | |
expect(actors).toBeDefined(); | |
expect(moviesConnection).toBeDefined(); | |
expect(actorsConnection).toBeDefined(); | |
expect(moviesAggregate).toBeUndefined(); | |
expect(actorsAggregate).toBeDefined(); | |
const moviesConnectionType = schema.getType("MoviesConnection") as GraphQLObjectType; | |
expect(moviesConnectionType).toBeDefined(); | |
const { aggregate, edges } = moviesConnectionType.getFields(); | |
expect(aggregate).toBeUndefined(); | |
expect(edges).toBeDefined(); | |
}); | |
test("should enable aggregation", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @node { | |
username: String! | |
password: String! | |
} | |
type Movie @query(aggregate: true) @node { | |
title: String | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const { movies, actors, moviesConnection, actorsConnection, moviesAggregate, actorsAggregate } = schema | |
.getQueryType() | |
?.getFields() as GraphQLFieldMap<any, any>; | |
expect(movies).toBeDefined(); | |
expect(actors).toBeDefined(); | |
expect(moviesConnection).toBeDefined(); | |
expect(actorsConnection).toBeDefined(); | |
expect(moviesAggregate).toBeDefined(); | |
expect(actorsAggregate).toBeDefined(); | |
const moviesConnectionType = schema.getType("MoviesConnection") as GraphQLObjectType; | |
expect(moviesConnectionType).toBeDefined(); | |
const { aggregate, edges } = moviesConnectionType.getFields(); | |
expect(aggregate).toBeDefined(); | |
expect(edges).toBeDefined(); | |
}); | |
test("should disable read and aggregate for Actor", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @query(read: false, aggregate: false) @node { | |
name: String | |
} | |
type Movie @node { | |
title: String | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const { movies, actors, moviesConnection, actorsConnection, moviesAggregate, actorsAggregate } = schema | |
.getQueryType() | |
?.getFields() as GraphQLFieldMap<any, any>; | |
expect(movies).toBeDefined(); | |
expect(actors).toBeUndefined(); | |
expect(moviesConnection).toBeDefined(); | |
expect(actorsConnection).toBeUndefined(); | |
expect(moviesAggregate).toBeDefined(); | |
expect(actorsAggregate).toBeUndefined(); | |
const actorsConnectionType = schema.getType("ActorsConnection") as GraphQLObjectType; | |
expect(actorsConnectionType).toBeUndefined(); | |
}); | |
test("should disable read and enable aggregate for Actor", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @query(read: false, aggregate: true) @node { | |
name: String | |
} | |
type Movie @node { | |
title: String | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const { movies, actors, moviesConnection, actorsConnection, moviesAggregate, actorsAggregate } = schema | |
.getQueryType() | |
?.getFields() as GraphQLFieldMap<any, any>; | |
expect(movies).toBeDefined(); | |
expect(actors).toBeUndefined(); | |
expect(moviesConnection).toBeDefined(); | |
expect(actorsConnection).toBeDefined(); | |
expect(moviesAggregate).toBeDefined(); | |
expect(actorsAggregate).toBeDefined(); | |
const actorsConnectionType = schema.getType("ActorsConnection") as GraphQLObjectType; | |
expect(actorsConnectionType).toBeDefined(); | |
const { aggregate, edges } = actorsConnectionType.getFields(); | |
expect(aggregate).toBeDefined(); | |
expect(edges).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/relationship-aggregate.test.ts
Lines 26 to 53 in e421830
test.skip("the default behavior should enable nested aggregation", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @node { | |
username: String! | |
password: String! | |
} | |
type Movie @node { | |
title: String | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const movieType = schema.getType("Movie") as GraphQLObjectType; | |
expect(movieType).toBeDefined(); | |
const { actorsAggregate, actorsConnection } = movieType.getFields(); | |
expect(actorsAggregate).toBeDefined(); | |
expect(actorsConnection).toBeDefined(); | |
const { aggregate, edges } = (actorsConnection?.type as GraphQLNonNull<GraphQLObjectType>).ofType.getFields(); | |
expect(aggregate).toBeDefined(); | |
expect(edges).toBeDefined(); | |
}); |
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/relationship-aggregate.test.ts
Lines 55 to 81 in e421830
test.skip("should disable nested aggregation", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @node { | |
username: String! | |
password: String! | |
} | |
type Movie @node { | |
title: String | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, aggregate: false) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const movieType = schema.getType("Movie") as GraphQLObjectType; | |
expect(movieType).toBeDefined(); | |
const { actorsAggregate, actorsConnection } = movieType.getFields(); | |
expect(actorsAggregate).toBeUndefined(); | |
expect(actorsConnection).toBeDefined(); | |
const { aggregate, edges } = (actorsConnection?.type as GraphQLNonNull<GraphQLObjectType>).ofType.getFields(); | |
expect(aggregate).toBeUndefined(); | |
expect(edges).toBeDefined(); | |
}); |
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/relationship-aggregate.test.ts
Lines 83 to 109 in e421830
test.skip("should enable nested aggregation", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @node { | |
username: String! | |
password: String! | |
} | |
type Movie @node { | |
title: String | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, aggregate: true) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const movieType = schema.getType("Movie") as GraphQLObjectType; | |
expect(movieType).toBeDefined(); | |
const { actorsAggregate, actorsConnection } = movieType.getFields(); | |
expect(actorsAggregate).toBeDefined(); | |
expect(actorsConnection).toBeDefined(); | |
const { aggregate, edges } = (actorsConnection?.type as GraphQLNonNull<GraphQLObjectType>).ofType.getFields(); | |
expect(aggregate).toBeDefined(); | |
expect(edges).toBeDefined(); | |
}); |
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/relationship-aggregate.test.ts
Lines 111 to 153 in e421830
test.skip("should work in conjunction with @query aggregate:false and @relationship aggregate:true", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @query(aggregate: false) @node { | |
username: String! | |
password: String! | |
} | |
type Movie @node { | |
title: String | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, aggregate: true) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const movieType = schema.getType("Movie") as GraphQLObjectType; | |
expect(movieType).toBeDefined(); | |
const { actorsAggregate, actorsConnection } = movieType.getFields(); | |
expect(actorsAggregate).toBeDefined(); | |
expect(actorsConnection).toBeDefined(); | |
const { aggregate, edges } = (actorsConnection?.type as GraphQLNonNull<GraphQLObjectType>).ofType.getFields(); | |
expect(aggregate).toBeDefined(); | |
expect(edges).toBeDefined(); | |
const { actorsAggregate: topLevelActorsAggregate, actorsConnection: topLevelActorsConnection } = schema | |
.getQueryType() | |
?.getFields() as GraphQLFieldMap<any, any>; | |
expect(topLevelActorsAggregate).toBeUndefined(); | |
expect(topLevelActorsConnection).toBeDefined(); | |
const { aggregate: topLevelAggregateInsideConnection, edges: topLevelEdgesInsideConnection } = ( | |
topLevelActorsConnection?.type as GraphQLNonNull<GraphQLObjectType> | |
).ofType.getFields(); | |
expect(topLevelAggregateInsideConnection).toBeUndefined(); | |
expect(topLevelEdgesInsideConnection).toBeDefined(); | |
}); |
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/relationship-aggregate.test.ts
Lines 155 to 196 in e421830
test.skip("should work in conjunction with @query aggregate:true and @relationship aggregate:false", async () => { | |
const typeDefs = /* GraphQL */ ` | |
type Actor @query(aggregate: true) @node { | |
username: String! | |
password: String! | |
} | |
type Movie @node { | |
title: String | |
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, aggregate: false) | |
} | |
`; | |
const neoSchema = new Neo4jGraphQL({ typeDefs }); | |
const schema = await neoSchema.getSchema(); | |
const movieType = schema.getType("Movie") as GraphQLObjectType; | |
expect(movieType).toBeDefined(); | |
const { actorsAggregate, actorsConnection } = movieType.getFields(); | |
expect(actorsAggregate).toBeUndefined(); | |
expect(actorsConnection).toBeDefined(); | |
const { aggregate, edges } = (actorsConnection?.type as GraphQLNonNull<GraphQLObjectType>).ofType.getFields(); | |
expect(aggregate).toBeUndefined(); | |
expect(edges).toBeDefined(); | |
const { actorsAggregate: topLevelActorsAggregate, actorsConnection: topLevelActorsConnection } = schema | |
.getQueryType() | |
?.getFields() as GraphQLFieldMap<any, any>; | |
expect(topLevelActorsAggregate).toBeDefined(); | |
expect(topLevelActorsConnection).toBeDefined(); | |
const { aggregate: topLevelAggregateInsideConnection, edges: topLevelEdgesInsideConnection } = ( | |
topLevelActorsConnection?.type as GraphQLNonNull<GraphQLObjectType> | |
).ofType.getFields(); | |
expect(topLevelAggregateInsideConnection).toBeDefined(); | |
expect(topLevelEdgesInsideConnection).toBeDefined(); | |
}); |
No description provided.