Skip to content
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

Open
wants to merge 378 commits into
base: dev
Choose a base branch
from
Open

7.x #5767

wants to merge 378 commits into from

Conversation

darrellwarde
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Nov 8, 2024

🦋 Changeset detected

Latest commit: 5a4e23f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@neo4j/graphql Major

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

* Subscriptions as an opt-in feature

* Remove inline await

* Update tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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,
},
},
},
]),
});
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test suite

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();
});
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <jest/no-disabled-tests> reported by reviewdog 🐶
Disabled test

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();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants