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

Migrate typename to typename #5927

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-tomatoes-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@neo4j/graphql": major
---

The `typename_IN` filter has been renamed to `typename`.
2 changes: 1 addition & 1 deletion packages/graphql/src/schema/generation/where-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function withWhereInputType({
name: entityAdapter.operations.implementationEnumTypename,
values: enumValues,
});
whereInputType.addFields({ typename_IN: { type: interfaceImplementation.NonNull.List } });
whereInputType.addFields({ typename: { type: interfaceImplementation.NonNull.List } });
}
}
return whereInputType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export class FilterFactory {
isAggregate,
});
}
if (key === "typename_IN") {
if (key === "typename") {
const acceptedEntities = entity.concreteEntities.filter((concreteEntity) => {
return valueAsArray.some((typenameFilterValue) => typenameFilterValue === concreteEntity.name);
});
Expand Down
24 changes: 12 additions & 12 deletions packages/graphql/tests/integration/delete-interface.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ describe("delete interface relationships", () => {
});

test("should delete one nested concrete entity", async () => {
const query = `
const query = /* GraphQL */ `
mutation DeleteActorAndMovie($name: String, $title: String) {
${actorType.operations.delete}(where: { name_EQ: $name }, delete: { actedIn: { where: { node: { typename_IN: [${movieType}], title_EQ: $title } } } } ) {
${actorType.operations.delete}(where: { name: { eq: $name } }, delete: { actedIn: { where: { node: { typename: [${movieType}], title: { eq: $title} } } } } ) {
nodesDeleted
relationshipsDeleted
}
Expand All @@ -163,13 +163,13 @@ describe("delete interface relationships", () => {
});

test("should delete one nested concrete entity using interface relationship fields", async () => {
const query = `
const query = /* GraphQL */ `
mutation DeleteActorAndMovie($name1: String, $movieScreenTime1: Int) {
${actorType.operations.delete}(
where: { name_EQ: $name1 }
where: { name: { eq: $name1 } }
delete: {
actedIn: {
where: { edge: { screenTime_EQ: $movieScreenTime1 } }
where: { edge: { screenTime: { eq: $movieScreenTime1 } } }
}
}
) {
Expand All @@ -194,13 +194,13 @@ describe("delete interface relationships", () => {
});

test("should delete two nested concrete entity using interface relationship fields", async () => {
const query = `
const query = /* GraphQL */ `
mutation DeleteActorAndMovie($name1: String, $movieScreenTime1: Int, $movieScreenTime2: Int) {
${actorType.operations.delete}(
where: { name_EQ: $name1 }
where: { name: { eq: $name1 } }
delete: {
actedIn: {
where: { edge: { OR: [ {screenTime_EQ: $movieScreenTime1 }, { screenTime_EQ: $movieScreenTime2 } ]} }
where: { edge: { OR: [ {screenTime: { eq: $movieScreenTime1 } }, { screenTime: { eq: $movieScreenTime2 } } ]} }
}
}
) {
Expand Down Expand Up @@ -229,16 +229,16 @@ describe("delete interface relationships", () => {
});

test("should be possible to double nested delete", async () => {
const query = `
const query = /* GraphQL */ `
mutation DeleteActorAndMovie($name1: String, $movieTitle2: String, $name2: String) {
${actorType.operations.delete}(
where: { name_EQ: $name1 }
where: { name: { eq: $name1 } }
delete: {
actedIn: {
where: { node: { title_EQ: $movieTitle2 } }
where: { node: { title: { eq: $movieTitle2 }} }
delete: {
actors: {
where: { node: { name_EQ: $name2 } }
where: { node: { name: { eq: $name2} } }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("typename_IN with auth", () => {
operations: [READ]
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Movie.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Movie.name}] }] } }
}
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ describe("typename_IN with auth", () => {
operations: [READ]
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Series.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Series.name}] }] } }
}
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ describe("typename_IN with auth", () => {
operations: [READ]
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Movie.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Movie.name}] }] } }
}
}
}
Expand Down Expand Up @@ -235,7 +235,7 @@ describe("typename_IN with auth", () => {
operations: [READ]
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Series.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Series.name}] }] } }
}
}
}
Expand Down Expand Up @@ -279,7 +279,7 @@ describe("typename_IN with auth", () => {
operations: [READ]
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Series.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Series.name}] }] } }
}
}
}
Expand Down Expand Up @@ -333,7 +333,7 @@ describe("typename_IN with auth", () => {
{
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Movie.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Movie.name}] }] } }
}
}
}
Expand Down Expand Up @@ -379,7 +379,7 @@ describe("typename_IN with auth", () => {
{
where: {
node: {
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename_IN: [${Series.name}] }] } }
actedInConnection_SOME: { node: { AND: [ { title_EQ: "The Matrix" }, {typename: [${Series.name}] }] } }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe("typename_IN", () => {
test("top-level", async () => {
const query = `
{
productions(where: { OR: [{ AND: [{ title_EQ: "The Matrix" }, { typename_IN: [${Movie.name}] }] }, { typename_IN: [${Series.name}] }]}) {
productions(where: { OR: [{ AND: [{ title_EQ: "The Matrix" }, { typename: [${Movie.name}] }] }, { typename: [${Series.name}] }]}) {
__typename
title
}
Expand Down Expand Up @@ -116,8 +116,8 @@ describe("typename_IN", () => {
{
${Actor.plural} {
actedIn(where: { OR: [
{ AND: [{ title_EQ: "The Matrix" }, { typename_IN: [${Movie.name}] }] }
{ typename_IN: [${Series.name}] }
{ AND: [{ title_EQ: "The Matrix" }, { typename: [${Movie.name}] }] }
{ typename: [${Series.name}] }
] }) {
__typename
title
Expand Down Expand Up @@ -149,7 +149,7 @@ describe("typename_IN", () => {
test("aggregation", async () => {
const query = `
{
productionsAggregate(where: { OR: [ { typename_IN: [${Movie.name}, ${Series.name}] } { typename_IN: [${Cartoon.name}] } ] }) {
productionsAggregate(where: { OR: [ { typename: [${Movie.name}, ${Series.name}] } { typename: [${Cartoon.name}] } ] }) {
count
}
}
Expand All @@ -168,7 +168,7 @@ describe("typename_IN", () => {
const query = `
{
${Actor.plural} {
actedInAggregate(where: { NOT: { typename_IN: [${Movie.name}, ${Series.name}] } }) {
actedInAggregate(where: { NOT: { typename: [${Movie.name}, ${Series.name}] } }) {
count
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ describe("interface filters of declared relationships", () => {
test("should filter using connection filters + typename_IN + logical", async () => {
const query = /* GraphQL */ `
query production {
productions(where: { OR: [{ typename_IN: [${Series}] }, {actorsConnection_SOME: { node: { name_EQ: "${actorName2}" } }}] }) {
productions(where: { OR: [{ typename: [${Series}] }, {actorsConnection_SOME: { node: { name_EQ: "${actorName2}" } }}] }) {
title
actorsConnection {
edges {
Expand Down Expand Up @@ -718,7 +718,7 @@ describe("interface filters of declared interface relationships", () => {
test("should filter using connection filters + typename_IN + logical", async () => {
const query = /* GraphQL */ `
query production {
productions(where: { OR: [{ typename_IN: [${Series}] }, {actorsConnection_SOME: { node: { name_EQ: "${actorName2}" } }}] }) {
productions(where: { OR: [{ typename: [${Series}] }, {actorsConnection_SOME: { node: { name_EQ: "${actorName2}" } }}] }) {
title
actorsConnection {
edges {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,7 @@ describe("interface with declared relationships", () => {
actedIn: {
connect: {
edge: { screenTime: 10 }
where: { node: { title_EQ: "${movieTitle}", typename_IN: [${Movie.name}] } }
where: { node: { title_EQ: "${movieTitle}", typename: [${Movie.name}] } }
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/graphql/tests/integration/issues/4583.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => {
actedIn: {
connect: {
edge: { screenTime: 10 }
where: { node: { title_EQ: "${movieTitle}", typename_IN: [${Movie.name}] } }
where: { node: { title_EQ: "${movieTitle}", typename: [${Movie.name}] } }
}
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => {
connect: {
actedIn: {
edge: { screenTime: 25 }
where: { node: { title_EQ: "${sameTitle}", typename_IN: [${Movie.name}]} }
where: { node: { title_EQ: "${sameTitle}", typename: [${Movie.name}]} }
}
}
}
Expand Down Expand Up @@ -261,8 +261,8 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => {
connect: {
edge: { screenTime: 10 }
where: { node: { OR: [
{ title_EQ: "${movieTitle}", typename_IN: [${Movie.name}]},
{ AND: [ {typename_IN: [${Series.name}]}, { NOT: { title_EQ: "${sameTitle}"} }] }
{ title_EQ: "${movieTitle}", typename: [${Movie.name}]},
{ AND: [ {typename: [${Series.name}]}, { NOT: { title_EQ: "${sameTitle}"} }] }
] } }
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/tests/schema/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ describe("Comments", () => {
title_EQ: String @deprecated(reason: \\"Please use the relevant generic filter title: { eq: ... }\\")
title_IN: [String!] @deprecated(reason: \\"Please use the relevant generic filter title: { in: ... }\\")
title_STARTS_WITH: String @deprecated(reason: \\"Please use the relevant generic filter title: { startsWith: ... }\\")
typename_IN: [ProductionImplementation!]
typename: [ProductionImplementation!]
}

type ProductionsConnection {
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/tests/schema/connections/interfaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe("Connection with interfaces", () => {
Return Creatures where some of the related Productions match this filter
\\"\\"\\"
movies_SOME: ProductionWhere @deprecated(reason: \\"Please use the relevant generic filter 'movies: { some: ... }' instead.\\")
typename_IN: [CreatureImplementation!]
typename: [CreatureImplementation!]
}

type CreaturesConnection {
Expand Down Expand Up @@ -870,7 +870,7 @@ describe("Connection with interfaces", () => {
id_EQ: ID @deprecated(reason: \\"Please use the relevant generic filter id: { eq: ... }\\")
id_IN: [ID] @deprecated(reason: \\"Please use the relevant generic filter id: { in: ... }\\")
id_STARTS_WITH: ID @deprecated(reason: \\"Please use the relevant generic filter id: { startsWith: ... }\\")
typename_IN: [ProductionImplementation!]
typename: [ProductionImplementation!]
}

type ProductionsConnection {
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql/tests/schema/directive-preserve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ describe("Directive-preserve", () => {
title_EQ: String @deprecated(reason: \\"Please use the relevant generic filter title: { eq: ... }\\")
title_IN: [String!] @deprecated(reason: \\"Please use the relevant generic filter title: { in: ... }\\")
title_STARTS_WITH: String @deprecated(reason: \\"Please use the relevant generic filter title: { startsWith: ... }\\")
typename_IN: [ProductionImplementation!]
typename: [ProductionImplementation!]
}

type ProductionsConnection {
Expand Down Expand Up @@ -2805,7 +2805,7 @@ describe("Directive-preserve", () => {
title_EQ: String @deprecated(reason: \\"Please use the relevant generic filter title: { eq: ... }\\")
title_IN: [String!] @deprecated(reason: \\"Please use the relevant generic filter title: { in: ... }\\")
title_STARTS_WITH: String @deprecated(reason: \\"Please use the relevant generic filter title: { startsWith: ... }\\")
typename_IN: [ProductionImplementation!]
typename: [ProductionImplementation!]
}

type ProductionsConnection {
Expand Down Expand Up @@ -3835,7 +3835,7 @@ describe("Directive-preserve", () => {
title_EQ: String @deprecated(reason: \\"Please use the relevant generic filter title: { eq: ... }\\")
title_IN: [String!] @deprecated(reason: \\"Please use the relevant generic filter title: { in: ... }\\")
title_STARTS_WITH: String @deprecated(reason: \\"Please use the relevant generic filter title: { startsWith: ... }\\")
typename_IN: [ProductionImplementation!]
typename: [ProductionImplementation!]
}

type ProductionsConnection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe("@customResolver directive", () => {
customResolver_EQ: String @deprecated(reason: \\"Please use the relevant generic filter customResolver: { eq: ... }\\")
customResolver_IN: [String] @deprecated(reason: \\"Please use the relevant generic filter customResolver: { in: ... }\\")
customResolver_STARTS_WITH: String @deprecated(reason: \\"Please use the relevant generic filter customResolver: { startsWith: ... }\\")
typename_IN: [UserInterfaceImplementation!]
typename: [UserInterfaceImplementation!]
}

type UserInterfacesConnection {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/tests/schema/directives/cypher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ describe("Cypher", () => {
AND: [ProductionWhere!]
NOT: ProductionWhere
OR: [ProductionWhere!]
typename_IN: [ProductionImplementation!]
typename: [ProductionImplementation!]
}

type ProductionsConnection {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/tests/schema/directives/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ describe("@default directive", () => {
toBeOverridden_EQ: String @deprecated(reason: \\"Please use the relevant generic filter toBeOverridden: { eq: ... }\\")
toBeOverridden_IN: [String!] @deprecated(reason: \\"Please use the relevant generic filter toBeOverridden: { in: ... }\\")
toBeOverridden_STARTS_WITH: String @deprecated(reason: \\"Please use the relevant generic filter toBeOverridden: { startsWith: ... }\\")
typename_IN: [UserInterfaceImplementation!]
typename: [UserInterfaceImplementation!]
}

type UserInterfacesConnection {
Expand Down
Loading