From 8bdcf6b36fba1442f75fe8401cf170ed17339cdb Mon Sep 17 00:00:00 2001 From: Michael Webb <28074382+mjfwebb@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:06:29 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Revert=20"Revert=20"Merge=20pull=20request?= =?UTF-8?q?=20#5892=20from=20mjfwebb/7x-connect-always-creat=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/thick-dogs-provide.md | 5 + .../create-connect-and-params.test.ts | 4 +- .../translate/create-connect-and-params.ts | 33 +------ .../src/translate/create-create-and-params.ts | 23 ----- .../create-relationship-validation-string.ts | 93 ------------------ .../src/translate/create-update-and-params.ts | 31 +----- .../graphql/src/translate/translate-create.ts | 1 - .../graphql/src/translate/translate-update.ts | 8 -- .../relationships/create/connect.int.test.ts | 95 ++++++++++++++++++- .../interface-simple.int.test.ts | 89 +++++++++++++---- .../connect-union.int.test.ts | 54 +++++++++++ .../tests/integration/update.int.test.ts | 3 +- .../relationship_properties/connect.test.ts | 8 +- .../arguments/allow/allow.test.ts | 2 +- .../arguments/roles-where.test.ts | 8 +- .../arguments/roles/roles.test.ts | 4 +- .../arguments/validate/validate.test.ts | 2 +- .../implementation-where.test.ts | 16 ++-- .../arguments/where/where.test.ts | 8 +- .../cypher-filtering-connect.test.ts | 2 +- .../create/connect.test.ts | 4 +- .../update/connect.test.ts | 12 +-- .../tck/directives/node/node-label.test.ts | 2 +- .../graphql/tests/tck/issues/1132.test.ts | 2 +- .../graphql/tests/tck/issues/4214.test.ts | 2 +- .../graphql/tests/tck/issues/4583.test.ts | 16 ++-- packages/graphql/tests/tck/issues/832.test.ts | 52 +++++----- packages/graphql/tests/tck/issues/894.test.ts | 2 +- .../graphql/tests/tck/nested-unions.test.ts | 4 +- .../batch/batch-create-interface.test.ts | 4 +- .../tck/operations/batch/batch-create.test.ts | 4 +- .../tests/tck/operations/connect.test.ts | 14 +-- .../tests/tck/operations/create.test.ts | 4 +- .../tests/tck/operations/update.test.ts | 6 +- packages/graphql/tests/tck/pringles.test.ts | 6 +- packages/graphql/tests/tck/union.test.ts | 4 +- 36 files changed, 322 insertions(+), 305 deletions(-) create mode 100644 .changeset/thick-dogs-provide.md delete mode 100644 packages/graphql/src/translate/create-relationship-validation-string.ts diff --git a/.changeset/thick-dogs-provide.md b/.changeset/thick-dogs-provide.md new file mode 100644 index 0000000000..94420920b6 --- /dev/null +++ b/.changeset/thick-dogs-provide.md @@ -0,0 +1,5 @@ +--- +"@neo4j/graphql": major +--- + +When performing a `connect` operation, new relationships are always created. diff --git a/packages/graphql/src/translate/create-connect-and-params.test.ts b/packages/graphql/src/translate/create-connect-and-params.test.ts index 47b2994c5b..403bed110f 100644 --- a/packages/graphql/src/translate/create-connect-and-params.test.ts +++ b/packages/graphql/src/translate/create-connect-and-params.test.ts @@ -138,7 +138,7 @@ describe("createConnectAndParams", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this0_node - MERGE (this)-[:\`SIMILAR\`]->(this0_node) + CREATE (this)-[:\`SIMILAR\`]->(this0_node) } } WITH this, this0_node @@ -153,7 +153,7 @@ describe("createConnectAndParams", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_node UNWIND connectedNodes as this0_node_similarMovies0_node - MERGE (this0_node)-[:\`SIMILAR\`]->(this0_node_similarMovies0_node) + CREATE (this0_node)-[:\`SIMILAR\`]->(this0_node_similarMovies0_node) } } WITH this, this0_node, this0_node_similarMovies0_node diff --git a/packages/graphql/src/translate/create-connect-and-params.ts b/packages/graphql/src/translate/create-connect-and-params.ts index abae9e5db2..d1b116c433 100644 --- a/packages/graphql/src/translate/create-connect-and-params.ts +++ b/packages/graphql/src/translate/create-connect-and-params.ts @@ -33,7 +33,6 @@ import { asArray } from "../utils/utils"; import { checkAuthentication } from "./authorization/check-authentication"; import { createAuthorizationAfterAndParams } from "./authorization/compatibility/create-authorization-after-and-params"; import { createAuthorizationBeforeAndParams } from "./authorization/compatibility/create-authorization-before-and-params"; -import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import { filterMetaVariable } from "./subscriptions/filter-meta-variable"; import { createWhereNodePredicate } from "./where/create-where-predicate"; @@ -59,7 +58,6 @@ function createConnectAndParams({ callbackBucket, labelOverride, parentNode, - includeRelationshipValidation, isFirstLevel = true, source, indexPrefix, @@ -74,7 +72,6 @@ function createConnectAndParams({ refNodes: Node[]; labelOverride?: string; parentNode: Node; - includeRelationshipValidation?: boolean; isFirstLevel?: boolean; source: "CREATE" | "UPDATE" | "CONNECT"; indexPrefix?: string; @@ -95,7 +92,6 @@ function createConnectAndParams({ const inStr = relationField.direction === "IN" ? "<-" : "-"; const outStr = relationField.direction === "OUT" ? "->" : "-"; const relTypeStr = `[${relationField.properties ? relationshipName : ""}:${relationField.type}]`; - const isOverwriteNotAllowed = connect.overwrite === false; const subquery: string[] = []; const labels = relatedNode.getLabelString(context); @@ -174,8 +170,7 @@ function createConnectAndParams({ subquery.push("\t\t\tWITH connectedNodes, parentNodes"); // subquery.push(`\t\t\tUNWIND parentNodes as ${parentVar}`); subquery.push(`\t\t\tUNWIND connectedNodes as ${nodeName}`); - const connectOperator = isOverwriteNotAllowed ? "CREATE" : "MERGE"; - subquery.push(`\t\t\t${connectOperator} (${parentVar})${inStr}${relTypeStr}${outStr}(${nodeName})`); + subquery.push(`\t\t\tCREATE (${parentVar})${inStr}${relTypeStr}${outStr}(${nodeName})`); if (relationField.properties) { const relationship = context.relationships.find( @@ -215,31 +210,6 @@ function createConnectAndParams({ const innerMetaStr = ""; - if (includeRelationshipValidation || isOverwriteNotAllowed) { - const relValidationStrs: string[] = []; - const matrixItems = [ - [parentNode, parentVar], - [relatedNode, nodeName], - ] as [Node, string][]; - - matrixItems.forEach((mi) => { - const relValidationStr = createRelationshipValidationString({ - node: mi[0], - context, - varName: mi[1], - ...(isOverwriteNotAllowed && { relationshipFieldNotOverwritable: relationField.fieldName }), - }); - if (relValidationStr) { - relValidationStrs.push(relValidationStr); - } - }); - - if (relValidationStrs.length) { - subquery.push(`\tWITH ${[...filterMetaVariable(withVars), nodeName].join(", ")}${innerMetaStr}`); - subquery.push(relValidationStrs.join("\n")); - } - } - subquery.push(`WITH ${[...filterMetaVariable(withVars), nodeName].join(", ")}${innerMetaStr}`); if (connect.connect) { @@ -275,7 +245,6 @@ function createConnectAndParams({ refNodes: [newRefNode], parentNode: relatedNode, labelOverride: relField.union ? newRefNode.name : "", - includeRelationshipValidation: true, isFirstLevel: false, source: "CONNECT", }); diff --git a/packages/graphql/src/translate/create-create-and-params.ts b/packages/graphql/src/translate/create-create-and-params.ts index 96cdca27bb..a08301bb76 100644 --- a/packages/graphql/src/translate/create-create-and-params.ts +++ b/packages/graphql/src/translate/create-create-and-params.ts @@ -27,7 +27,6 @@ import { createAuthorizationAfterAndParamsField, } from "./authorization/compatibility/create-authorization-after-and-params"; import createConnectAndParams from "./create-connect-and-params"; -import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import { assertNonAmbiguousUpdate } from "./utils/assert-non-ambiguous-update"; import { addCallbackAndSetParam } from "./utils/callback-utils"; @@ -57,7 +56,6 @@ function createCreateAndParams({ context, callbackBucket, withVars, - includeRelationshipValidation, topLevelNodeVariable, authorizationPrefix = [0], }: { @@ -67,7 +65,6 @@ function createCreateAndParams({ context: Neo4jGraphQLTranslationContext; callbackBucket: CallbackBucket; withVars: string[]; - includeRelationshipValidation?: boolean; topLevelNodeVariable?: string; //used to build authorization variable in auth subqueries authorizationPrefix?: number[]; @@ -144,7 +141,6 @@ function createCreateAndParams({ node: refNode, varName: nodeName, withVars: [...withVars, nodeName], - includeRelationshipValidation: false, topLevelNodeVariable, authorizationPrefix: [...authorizationPrefix, reducerIndex, createIndex, refNodeIndex], }); @@ -184,16 +180,6 @@ function createCreateAndParams({ } res.meta.authorizationPredicates.push(...authorizationPredicates); } - - const relationshipValidationStr = createRelationshipValidationString({ - node: refNode, - context, - varName: nodeName, - }); - if (relationshipValidationStr) { - res.creates.push(`WITH *`); - res.creates.push(relationshipValidationStr); - } }); } @@ -331,15 +317,6 @@ function createCreateAndParams({ params = { ...params, ...authParams }; } - if (includeRelationshipValidation) { - const str = createRelationshipValidationString({ node, context, varName }); - - if (str) { - creates.push(`WITH *`); - creates.push(str); - } - } - return { create: creates.join("\n"), params, authorizationPredicates, authorizationSubqueries }; } diff --git a/packages/graphql/src/translate/create-relationship-validation-string.ts b/packages/graphql/src/translate/create-relationship-validation-string.ts deleted file mode 100644 index d9a5171fb0..0000000000 --- a/packages/graphql/src/translate/create-relationship-validation-string.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) "Neo4j" - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type { Node } from "../classes"; -import { RELATIONSHIP_REQUIREMENT_PREFIX } from "../constants"; -import type { Neo4jGraphQLTranslationContext } from "../types/neo4j-graphql-translation-context"; - -export function createRelationshipValidationString({ - node, - context, - varName, - relationshipFieldNotOverwritable, -}: { - node: Node; - context: Neo4jGraphQLTranslationContext; - varName: string; - relationshipFieldNotOverwritable?: string; -}): string { - const strs: string[] = []; - - node.relationFields.forEach((field) => { - const isArray = field.typeMeta.array; - const isUnionOrInterface = Boolean(field.union) || Boolean(field.interface); - if (isUnionOrInterface) { - return; - } - - const toNode = context.nodes.find((n) => n.name === field.typeMeta.name) as Node; - const inStr = field.direction === "IN" ? "<-" : "-"; - const outStr = field.direction === "OUT" ? "->" : "-"; - const relVarname = `${varName}_${field.fieldName}_${toNode.name}_unique`; - - let predicate: string; - let errorMsg: string; - let subQuery: string | undefined; - if (isArray) { - if (relationshipFieldNotOverwritable === field.fieldName) { - predicate = `c = 1`; - errorMsg = `${RELATIONSHIP_REQUIREMENT_PREFIX}${node.name}.${field.fieldName} required exactly once for a specific ${toNode.name}`; - subQuery = [ - `CALL {`, - `\tWITH ${varName}`, - `\tMATCH (${varName})${inStr}[${relVarname}:${field.type}]${outStr}(other${toNode.getLabelString( - context - )})`, - `\tWITH count(${relVarname}) as c, other`, - `\tWHERE apoc.util.validatePredicate(NOT (${predicate}), '${errorMsg}', [0])`, - `\tRETURN collect(c) AS ${relVarname}_ignored`, - `}`, - ].join("\n"); - } - } else { - predicate = `c = 1`; - errorMsg = `${RELATIONSHIP_REQUIREMENT_PREFIX}${node.name}.${field.fieldName} required exactly once`; - if (!field.typeMeta.required) { - predicate = `c <= 1`; - errorMsg = `${RELATIONSHIP_REQUIREMENT_PREFIX}${node.name}.${field.fieldName} must be less than or equal to one`; - } - - subQuery = [ - `CALL {`, - `\tWITH ${varName}`, - `\tMATCH (${varName})${inStr}[${relVarname}:${field.type}]${outStr}(${toNode.getLabelString(context)})`, - `\tWITH count(${relVarname}) as c`, - `\tWHERE apoc.util.validatePredicate(NOT (${predicate}), '${errorMsg}', [0])`, - `\tRETURN c AS ${relVarname}_ignored`, - `}`, - ].join("\n"); - } - - if (subQuery) { - strs.push(subQuery); - } - }); - - return strs.join("\n"); -} diff --git a/packages/graphql/src/translate/create-update-and-params.ts b/packages/graphql/src/translate/create-update-and-params.ts index 8e80f506c9..67b8a012fc 100644 --- a/packages/graphql/src/translate/create-update-and-params.ts +++ b/packages/graphql/src/translate/create-update-and-params.ts @@ -38,7 +38,6 @@ import createConnectAndParams from "./create-connect-and-params"; import createCreateAndParams from "./create-create-and-params"; import createDeleteAndParams from "./create-delete-and-params"; import createDisconnectAndParams from "./create-disconnect-and-params"; -import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import { assertNonAmbiguousUpdate } from "./utils/assert-non-ambiguous-update"; import { addCallbackAndSetParam } from "./utils/callback-utils"; @@ -73,7 +72,6 @@ export default function createUpdateAndParams({ context, callbackBucket, parameterPrefix, - includeRelationshipValidation, }: { parentVar: string; updateInput: any; @@ -84,7 +82,6 @@ export default function createUpdateAndParams({ context: Neo4jGraphQLTranslationContext; callbackBucket: CallbackBucket; parameterPrefix: string; - includeRelationshipValidation?: boolean; }): [string, any] { let hasAppliedTimeStamps = false; @@ -306,7 +303,6 @@ export default function createUpdateAndParams({ parameterPrefix: `${parameterPrefix}.${key}${ relationField.union ? `.${refNode.name}` : "" }${relationField.typeMeta.array ? `[${index}]` : ``}.update.node`, - includeRelationshipValidation: true, }); res.params = { ...res.params, ...updateAndParams[1] }; innerUpdate.push(updateAndParams[0]); @@ -429,7 +425,6 @@ export default function createUpdateAndParams({ callbackBucket, varName: nodeName, withVars: [...withVars, nodeName], - includeRelationshipValidation: false, ...createNodeInput, }); subquery.push(nestedCreate); @@ -465,16 +460,6 @@ export default function createUpdateAndParams({ subquery.push( ...getAuthorizationStatements(authorizationPredicates, authorizationSubqueries) ); - - const relationshipValidationStr = createRelationshipValidationString({ - node: refNode, - context, - varName: nodeName, - }); - if (relationshipValidationStr) { - subquery.push(`WITH ${[...withVars, nodeName].join(", ")}`); - subquery.push(relationshipValidationStr); - } }); } @@ -626,11 +611,6 @@ export default function createUpdateAndParams({ const preUpdatePredicates = authorizationBeforeStrs; - const preArrayMethodValidationStr = ""; - const relationshipValidationStr = includeRelationshipValidation - ? createRelationshipValidationString({ node, context, varName }) - : ""; - if (meta.preArrayMethodValidationStrs.length) { const nullChecks = meta.preArrayMethodValidationStrs.map((validationStr) => `${validationStr[0]} IS NULL`); const propertyNames = meta.preArrayMethodValidationStrs.map((validationStr) => validationStr[1]); @@ -670,16 +650,7 @@ export default function createUpdateAndParams({ const statements = strs; - return [ - [ - preUpdatePredicatesStr, - preArrayMethodValidationStr, - ...statements, - authorizationAfterStr, - ...(relationshipValidationStr ? [withStr, relationshipValidationStr] : []), - ].join("\n"), - params, - ]; + return [[preUpdatePredicatesStr, ...statements, authorizationAfterStr].join("\n"), params]; } function validateNonNullProperty(res: Res, varName: string, field: BaseField) { diff --git a/packages/graphql/src/translate/translate-create.ts b/packages/graphql/src/translate/translate-create.ts index ba2b10814f..9c5b852971 100644 --- a/packages/graphql/src/translate/translate-create.ts +++ b/packages/graphql/src/translate/translate-create.ts @@ -84,7 +84,6 @@ export default async function translateCreate({ context, varName, withVars, - includeRelationshipValidation: true, topLevelNodeVariable: varName, callbackBucket, }); diff --git a/packages/graphql/src/translate/translate-update.ts b/packages/graphql/src/translate/translate-update.ts index 448c0952c3..33e86d05f3 100644 --- a/packages/graphql/src/translate/translate-update.ts +++ b/packages/graphql/src/translate/translate-update.ts @@ -29,7 +29,6 @@ import createConnectAndParams from "./create-connect-and-params"; import createCreateAndParams from "./create-create-and-params"; import createDeleteAndParams from "./create-delete-and-params"; import createDisconnectAndParams from "./create-disconnect-and-params"; -import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import createUpdateAndParams from "./create-update-and-params"; import { QueryASTContext, QueryASTEnv } from "./queryAST/ast/QueryASTContext"; @@ -62,7 +61,6 @@ export default async function translateUpdate({ const disconnectStrs: string[] = []; const createStrs: string[] = []; let deleteStr = ""; - const assumeReconnecting = Boolean(connectInput) && Boolean(disconnectInput); const matchNode = new Cypher.NamedNode(varName); const where = resolveTree.args.where as GraphQLWhereArg | undefined; const matchPattern = new Cypher.Pattern(matchNode, { labels: node.getLabels(context) }); @@ -172,7 +170,6 @@ export default async function translateUpdate({ parentVar: varName, withVars, parameterPrefix: `${resolveTree.name}.args.update`, - includeRelationshipValidation: false, }); [updateStr] = updateAndParams; cypherParams = { @@ -237,7 +234,6 @@ export default async function translateUpdate({ withVars, parentNode: node, labelOverride: "", - includeRelationshipValidation: !!assumeReconnecting, source: "UPDATE", }); connectStrs.push(connectAndParams[0]); @@ -352,7 +348,6 @@ export default async function translateUpdate({ input: create.node, varName: nodeName, withVars: [...withVars, nodeName], - includeRelationshipValidation: false, }); createStrs.push(nestedCreate); cypherParams = { ...cypherParams, ...params }; @@ -411,8 +406,6 @@ export default async function translateUpdate({ ? Cypher.utils.concat(...queryASTResult.clauses) : new Cypher.Return(new Cypher.Literal("Query cannot conclude with CALL")); - const relationshipValidationStr = createRelationshipValidationString({ node, context, varName }); - const updateQuery = new Cypher.Raw((env) => { const cypher = [ matchAndWhereStr, @@ -430,7 +423,6 @@ export default async function translateUpdate({ ? [`WITH *`] : []), // When FOREACH is the last line of update 'Neo4jError: WITH is required between FOREACH and CALL' - ...(relationshipValidationStr ? [`WITH *`, relationshipValidationStr] : []), ...connectionStrs, ...interfaceStrs, compileCypher(projectionStatements, env), diff --git a/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts b/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts index 7378938d71..012b4a17ce 100644 --- a/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts +++ b/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts @@ -76,7 +76,7 @@ describe("interface relationships", () => { await testHelper.close(); }); - test("should nested create connect using interface relationship fields", async () => { + test("create->connect->connect should connect using interface relationship fields", async () => { const actorName1 = generate({ readable: true, charset: "alphabetic", @@ -163,4 +163,97 @@ describe("interface relationships", () => { }, }); }); + + test("create->connect->connect should create a new relationship using interface relationship fields", async () => { + const actorName1 = generate({ + readable: true, + charset: "alphabetic", + }); + const actorName2 = generate({ + readable: true, + charset: "alphabetic", + }); + + const movieTitle = generate({ + readable: true, + charset: "alphabetic", + }); + const movieRuntime = 20340; + const movieScreenTime = 87163; + + const query = ` + mutation CreateActorConnectMovie($name1: String!, $title: String, $screenTime: Int!, $name2: String) { + ${Actor.operations.create}( + input: [ + { + name: $name1 + actedIn: { + connect: { + edge: { screenTime: $screenTime } + where: { node: { title_EQ: $title } } + connect: { + actors: { edge: { ActedIn: { screenTime: $screenTime } }, where: { node: { name_EQ: $name2 } } } + } + } + } + } + ] + ) { + ${Actor.plural} { + name + actedIn { + title + actors { + name + } + ... on ${Movie} { + runtime + } + } + } + } + } + `; + + await testHelper.executeCypher( + ` + CREATE (m:${Movie} { title: $movieTitle, runtime:$movieRuntime }) + CREATE (:${Actor} { name: $name })-[:ACTED_IN { screenTime: $movieScreenTime }]->(m) + + `, + { movieTitle, movieRuntime, name: actorName2, movieScreenTime } + ); + + const gqlResult = await testHelper.executeGraphQL(query, { + variableValues: { + name1: actorName1, + title: movieTitle, + screenTime: movieScreenTime, + name2: actorName2, + }, + }); + + expect(gqlResult.errors).toBeFalsy(); + + expect(gqlResult.data).toEqual({ + [Actor.operations.create]: { + [Actor.plural]: [ + { + actedIn: [ + { + runtime: movieRuntime, + title: movieTitle, + actors: expect.toIncludeSameMembers([ + { name: actorName2 }, + { name: actorName1 }, + { name: actorName2 }, + ]), + }, + ], + name: actorName1, + }, + ], + }, + }); + }); }); diff --git a/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts b/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts index 7574474f7f..a177244631 100644 --- a/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts +++ b/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts @@ -1451,22 +1451,36 @@ describe("interface with declared relationships", () => { edges: expect.toIncludeSameMembers([ { node: { - title: movieTitle2, + title: movieTitle, actorsConnection: { edges: expect.toIncludeSameMembers([ { node: { - name: actorName2, + name: actorName3, actedInConnection: { edges: expect.toIncludeSameMembers([ { - node: { title: movieTitle2, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 111 }, }, ]), }, }, - properties: { screenTime: movieScreenTime }, + properties: { screenTime: 111 }, + }, + { + node: { + name: actorName3, + actedInConnection: { + edges: expect.toIncludeSameMembers([ + { + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 111 }, + }, + ]), + }, + }, + properties: { screenTime: 111 }, }, { node: { @@ -1499,22 +1513,22 @@ describe("interface with declared relationships", () => { }, { node: { - title: movieTitle, + title: movieTitle2, actorsConnection: { - edges: [ + edges: expect.toIncludeSameMembers([ { node: { - name: actorName3, + name: actorName2, actedInConnection: { - edges: [ + edges: expect.toIncludeSameMembers([ { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, + node: { title: movieTitle2, runtime: movieRuntime }, + properties: { screenTime: movieScreenTime }, }, - ], + ]), }, }, - properties: { screenTime: 111 }, + properties: { screenTime: movieScreenTime }, }, { node: { @@ -1541,7 +1555,7 @@ describe("interface with declared relationships", () => { }, properties: { screenTime: movieScreenTime }, }, - ], + ]), }, }, }, @@ -1660,6 +1674,20 @@ describe("interface with declared relationships", () => { }, properties: { screenTime: 111 }, }, + { + node: { + name: actorName3, + actedInConnection: { + edges: expect.toIncludeSameMembers([ + { + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 111 }, + }, + ]), + }, + }, + properties: { screenTime: 111 }, + }, { node: { name: actorName, @@ -1712,9 +1740,8 @@ describe("interface with declared relationships", () => { edge: { screenTime: 112 } where: { node: { title_EQ: "${movieTitle}" } } connect: { - actors: [{ + actors: [{ edge: { ActedIn: { screenTime: 111 }, StarredIn: { episodeNr: 111 } }, - }] } }] @@ -1794,7 +1821,7 @@ describe("interface with declared relationships", () => { edges: expect.toIncludeSameMembers([ { node: { - name: actorName2, + name: actorName, actedInConnection: { edges: expect.toIncludeSameMembers([ { @@ -1808,18 +1835,40 @@ describe("interface with declared relationships", () => { }, { node: { - name: actorName, + name: actorName2, actedInConnection: { - edges: [ + edges: expect.toIncludeSameMembers([ { node: { title: movieTitle, runtime: movieRuntime }, properties: { screenTime: 111 }, }, - ], + { + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 112 }, + }, + ]), }, }, properties: { screenTime: 111 }, }, + { + node: { + name: actorName2, + actedInConnection: { + edges: expect.toIncludeSameMembers([ + { + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 111 }, + }, + { + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 112 }, + }, + ]), + }, + }, + properties: { screenTime: 112 }, + }, ]), }, }, diff --git a/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts b/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts index 7e7f220b10..cafc808b7a 100644 --- a/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts +++ b/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts @@ -170,4 +170,58 @@ describe("Relationship properties - connect on union", () => { const neo4jResult = await testHelper.executeCypher(cypher, { movieTitle, screenTime, actorName }); expect(neo4jResult.records).toHaveLength(1); }); + + test("should update an actor while connecting an existing relationship that has properties(with Union)", async () => { + const movieTitle = generate({ charset: "alphabetic" }); + const actorName = generate({ charset: "alphabetic" }); + const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); + + const source = /* GraphQL */ ` + mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { + ${Actor.operations.update}( + where: { name_EQ: $actorName } + update: { + actedIn: { + ${Movie}: { + connect: { + where: { node: { title_EQ: $movieTitle } } + edge: { screenTime: $screenTime } + } + } + } + } + ) { + ${Actor.plural} { + name + } + } + } + `; + + await testHelper.executeCypher( + ` + CREATE (:${Movie} {title:$movieTitle}) + CREATE (:${Actor} {name:$actorName})-[:ACTED_IN {screenTime: 0}]->(:${Movie} {title: $movieTitle}) + `, + { movieTitle, actorName } + ); + + const gqlResult = await testHelper.executeGraphQL(source, { + variableValues: { movieTitle, actorName, screenTime }, + }); + expect(gqlResult.errors).toBeFalsy(); + expect((gqlResult.data as any)[Actor.operations.update][Actor.plural]).toEqual([ + { + name: actorName, + }, + ]); + + const cypher = ` + MATCH (a:${Actor} {name: $actorName})-[:ACTED_IN {screenTime: $screenTime}]->(:${Movie} {title: $movieTitle}) + RETURN a + `; + + const neo4jResult = await testHelper.executeCypher(cypher, { movieTitle, screenTime, actorName }); + expect(neo4jResult.records).toHaveLength(2); + }); }); diff --git a/packages/graphql/tests/integration/update.int.test.ts b/packages/graphql/tests/integration/update.int.test.ts index 60c0aa131c..95643bfd30 100644 --- a/packages/graphql/tests/integration/update.int.test.ts +++ b/packages/graphql/tests/integration/update.int.test.ts @@ -134,6 +134,7 @@ describe("update", () => { expect(gqlResult?.data?.[Movie.operations.update]).toEqual({ [Movie.plural]: [{ id, name: updatedName }] }); }); + test("should connect through interface relationship", async () => { const typeDefs = /* GraphQL */ ` type ${Movie} implements Production @subscription(events: []) @node { @@ -217,7 +218,7 @@ describe("update", () => { ` ); - expect(cypherResult.records).toHaveLength(1); + expect(cypherResult.records).toHaveLength(2); expect(gqlResult?.data?.[Movie.operations.update]).toEqual({ [Movie.plural]: [{ id: "1", title: "Movie1" }], diff --git a/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts b/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts index 96e3f5e2e3..5e0b58c752 100644 --- a/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts +++ b/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts @@ -84,7 +84,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - MERGE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) + CREATE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) SET this0_actors_connect0_relationship.screenTime = $this0_actors_connect0_relationship_screenTime } } @@ -173,7 +173,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - MERGE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) + CREATE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) SET this0_actors_connect0_relationship.screenTime = $this0_actors_connect0_relationship_screenTime } } @@ -255,7 +255,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) SET this_actors0_connect0_relationship.screenTime = $this_actors0_connect0_relationship_screenTime } } @@ -336,7 +336,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) SET this_actors0_connect0_relationship.screenTime = $this_actors0_connect0_relationship_screenTime } } diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts index 29a4600287..e79cbf0be4 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts @@ -858,7 +858,7 @@ describe("Cypher Auth Allow", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts index 73d7645661..7590e1b741 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts @@ -887,7 +887,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -978,7 +978,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -1059,7 +1059,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -1138,7 +1138,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts index 9a7adfcc66..912fbaf372 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts @@ -455,7 +455,7 @@ describe("Cypher Auth Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -530,7 +530,7 @@ describe("Cypher Auth Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_post0 UNWIND connectedNodes as this_post0_creator0_connect0_node - MERGE (this_post0)-[:HAS_POST]->(this_post0_creator0_connect0_node) + CREATE (this_post0)-[:HAS_POST]->(this_post0_creator0_connect0_node) } } WITH this, this_post0, this_post0_creator0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts index 8681069759..7f2e035a57 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts @@ -397,7 +397,7 @@ describe("Cypher Auth Allow", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_creator0_connect0_node - MERGE (this)<-[:HAS_POST]-(this_creator0_connect0_node) + CREATE (this)<-[:HAS_POST]-(this_creator0_connect0_node) } } WITH this, this_creator0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts index 288e9bb235..90d83f6c97 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts @@ -668,7 +668,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect0_node - MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) + CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) } } WITH this0, this0_content_connect0_node @@ -688,7 +688,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect1_node - MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) + CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) } } WITH this0, this0_content_connect1_node @@ -761,7 +761,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect0_node - MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) + CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) } } WITH this0, this0_content_connect0_node @@ -781,7 +781,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect1_node - MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) + CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) } } WITH this0, this0_content_connect1_node @@ -848,7 +848,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node @@ -873,7 +873,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node @@ -933,7 +933,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node @@ -958,7 +958,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts index 9c815a2d15..6ff9c36a1e 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts @@ -837,7 +837,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -915,7 +915,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -983,7 +983,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -1043,7 +1043,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node diff --git a/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts b/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts index 1238ba9e7d..766bf9897c 100644 --- a/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts +++ b/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts @@ -110,7 +110,7 @@ describe("cypher directive filtering", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) } } WITH this0, this0_actors_connect0_node diff --git a/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts b/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts index cffd5660d9..18c4151611 100644 --- a/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts +++ b/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts @@ -105,7 +105,7 @@ describe("Interface Relationships - Create connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -123,7 +123,7 @@ describe("Interface Relationships - Create connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } diff --git a/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts b/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts index 38d64f3fd5..e2efef2812 100644 --- a/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts +++ b/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts @@ -94,7 +94,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -117,7 +117,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -186,7 +186,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -202,7 +202,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_actedIn0_connect0_node UNWIND connectedNodes as this_actedIn0_connect0_node_actors0_node - MERGE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) + CREATE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) SET this_actedIn0_connect0_node_actors0_relationship.screenTime = $this_actedIn0_connect0_node_actors0_relationship_ActedIn_screenTime } } @@ -227,7 +227,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -243,7 +243,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_actedIn0_connect0_node UNWIND connectedNodes as this_actedIn0_connect0_node_actors0_node - MERGE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) + CREATE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) SET this_actedIn0_connect0_node_actors0_relationship.screenTime = $this_actedIn0_connect0_node_actors0_relationship_ActedIn_screenTime } } diff --git a/packages/graphql/tests/tck/directives/node/node-label.test.ts b/packages/graphql/tests/tck/directives/node/node-label.test.ts index 86d9fa8e48..b467a87dbd 100644 --- a/packages/graphql/tests/tck/directives/node/node-label.test.ts +++ b/packages/graphql/tests/tck/directives/node/node-label.test.ts @@ -366,7 +366,7 @@ describe("Label in Node directive", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - MERGE (this)<-[:ACTED_IN]-(this_actors0_connect0_node) + CREATE (this)<-[:ACTED_IN]-(this_actors0_connect0_node) } } WITH this, this_actors0_connect0_node diff --git a/packages/graphql/tests/tck/issues/1132.test.ts b/packages/graphql/tests/tck/issues/1132.test.ts index 1aea95bb7b..f91bcaf0c8 100644 --- a/packages/graphql/tests/tck/issues/1132.test.ts +++ b/packages/graphql/tests/tck/issues/1132.test.ts @@ -78,7 +78,7 @@ describe("https://github.com/neo4j/graphql/issues/1132", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_targets0_connect0_node - MERGE (this)-[:HAS_TARGET]->(this_targets0_connect0_node) + CREATE (this)-[:HAS_TARGET]->(this_targets0_connect0_node) } } WITH this, this_targets0_connect0_node diff --git a/packages/graphql/tests/tck/issues/4214.test.ts b/packages/graphql/tests/tck/issues/4214.test.ts index d69dc12b88..14b77d629f 100644 --- a/packages/graphql/tests/tck/issues/4214.test.ts +++ b/packages/graphql/tests/tck/issues/4214.test.ts @@ -193,7 +193,7 @@ describe("https://github.com/neo4j/graphql/issues/4214", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_transaction_connect0_node - MERGE (this0)-[:ITEM_TRANSACTED]->(this0_transaction_connect0_node) + CREATE (this0)-[:ITEM_TRANSACTED]->(this0_transaction_connect0_node) } } WITH this0, this0_transaction_connect0_node diff --git a/packages/graphql/tests/tck/issues/4583.test.ts b/packages/graphql/tests/tck/issues/4583.test.ts index b063adb4ef..d15702e84b 100644 --- a/packages/graphql/tests/tck/issues/4583.test.ts +++ b/packages/graphql/tests/tck/issues/4583.test.ts @@ -103,7 +103,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -121,7 +121,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } @@ -196,7 +196,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -214,7 +214,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } @@ -295,7 +295,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -311,7 +311,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_actedIn_connect0_node UNWIND connectedNodes as this0_actedIn_connect0_node_actors0_node - MERGE (this0_actedIn_connect0_node)<-[this0_actedIn_connect0_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect0_node_actors0_node) + CREATE (this0_actedIn_connect0_node)<-[this0_actedIn_connect0_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect0_node_actors0_node) SET this0_actedIn_connect0_node_actors0_relationship.screenTime = $this0_actedIn_connect0_node_actors0_relationship_ActedIn_screenTime } } @@ -331,7 +331,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } @@ -347,7 +347,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_actedIn_connect1_node UNWIND connectedNodes as this0_actedIn_connect1_node_actors0_node - MERGE (this0_actedIn_connect1_node)<-[this0_actedIn_connect1_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect1_node_actors0_node) + CREATE (this0_actedIn_connect1_node)<-[this0_actedIn_connect1_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect1_node_actors0_node) SET this0_actedIn_connect1_node_actors0_relationship.episodeNr = $this0_actedIn_connect1_node_actors0_relationship_StarredIn_episodeNr } } diff --git a/packages/graphql/tests/tck/issues/832.test.ts b/packages/graphql/tests/tck/issues/832.test.ts index 5a3c57c3d1..491217a941 100644 --- a/packages/graphql/tests/tck/issues/832.test.ts +++ b/packages/graphql/tests/tck/issues/832.test.ts @@ -99,7 +99,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -116,7 +116,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -134,7 +134,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -151,7 +151,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -175,7 +175,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect0_node - MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) + CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) } } WITH this1, this1_subjects_connect0_node @@ -192,7 +192,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect1_node - MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) + CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) } } WITH this1, this1_subjects_connect1_node @@ -210,7 +210,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect0_node - MERGE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) + CREATE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) } } WITH this1, this1_objects_connect0_node @@ -227,7 +227,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect1_node - MERGE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) + CREATE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) } } WITH this1, this1_objects_connect1_node @@ -324,7 +324,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -341,7 +341,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -359,7 +359,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -376,7 +376,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -454,7 +454,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -471,7 +471,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -489,7 +489,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -506,7 +506,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -595,7 +595,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -612,7 +612,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -630,7 +630,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -647,7 +647,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -671,7 +671,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect0_node - MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) + CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) } } WITH this1, this1_subjects_connect0_node @@ -688,7 +688,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect1_node - MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) + CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) } } WITH this1, this1_subjects_connect1_node @@ -706,7 +706,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect0_node - MERGE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) + CREATE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) } } WITH this1, this1_objects_connect0_node @@ -723,7 +723,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect1_node - MERGE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) + CREATE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) } } WITH this1, this1_objects_connect1_node @@ -884,7 +884,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -901,7 +901,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node diff --git a/packages/graphql/tests/tck/issues/894.test.ts b/packages/graphql/tests/tck/issues/894.test.ts index 3253a530ea..8484525298 100644 --- a/packages/graphql/tests/tck/issues/894.test.ts +++ b/packages/graphql/tests/tck/issues/894.test.ts @@ -92,7 +92,7 @@ describe("https://github.com/neo4j/graphql/issues/894", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_activeOrganization0_connect0_node - MERGE (this)-[:ACTIVELY_MANAGING]->(this_activeOrganization0_connect0_node) + CREATE (this)-[:ACTIVELY_MANAGING]->(this_activeOrganization0_connect0_node) } } WITH this, this_activeOrganization0_connect0_node diff --git a/packages/graphql/tests/tck/nested-unions.test.ts b/packages/graphql/tests/tck/nested-unions.test.ts index 215115fb8d..154cf55962 100644 --- a/packages/graphql/tests/tck/nested-unions.test.ts +++ b/packages/graphql/tests/tck/nested-unions.test.ts @@ -106,7 +106,7 @@ describe("Nested Unions", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors_LeadActor0_connect0_node - MERGE (this)<-[:ACTED_IN]-(this_actors_LeadActor0_connect0_node) + CREATE (this)<-[:ACTED_IN]-(this_actors_LeadActor0_connect0_node) } } WITH this, this_actors_LeadActor0_connect0_node @@ -121,7 +121,7 @@ describe("Nested Unions", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_actors_LeadActor0_connect0_node UNWIND connectedNodes as this_actors_LeadActor0_connect0_node_actedIn_Series0_node - MERGE (this_actors_LeadActor0_connect0_node)-[:ACTED_IN]->(this_actors_LeadActor0_connect0_node_actedIn_Series0_node) + CREATE (this_actors_LeadActor0_connect0_node)-[:ACTED_IN]->(this_actors_LeadActor0_connect0_node_actedIn_Series0_node) } } WITH this, this_actors_LeadActor0_connect0_node, this_actors_LeadActor0_connect0_node_actedIn_Series0_node diff --git a/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts b/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts index 2ba63f4b2c..f32546e9a9 100644 --- a/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts +++ b/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts @@ -305,7 +305,7 @@ describe("Batch Create, Interface", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this3 UNWIND connectedNodes as this3_workers_connect0_node - MERGE (this3)<-[this3_workers_connect0_relationship:EMPLOYED]-(this3_workers_connect0_node) + CREATE (this3)<-[this3_workers_connect0_relationship:EMPLOYED]-(this3_workers_connect0_node) } } WITH this3, this3_workers_connect0_node @@ -322,7 +322,7 @@ describe("Batch Create, Interface", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this3 UNWIND connectedNodes as this3_workers_connect1_node - MERGE (this3)<-[this3_workers_connect1_relationship:EMPLOYED]-(this3_workers_connect1_node) + CREATE (this3)<-[this3_workers_connect1_relationship:EMPLOYED]-(this3_workers_connect1_node) } } WITH this3, this3_workers_connect1_node diff --git a/packages/graphql/tests/tck/operations/batch/batch-create.test.ts b/packages/graphql/tests/tck/operations/batch/batch-create.test.ts index f12d964b32..1030c77e24 100644 --- a/packages/graphql/tests/tck/operations/batch/batch-create.test.ts +++ b/packages/graphql/tests/tck/operations/batch/batch-create.test.ts @@ -348,7 +348,7 @@ describe("Batch Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - MERGE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) + CREATE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) } } WITH this0, this0_actors_connect0_node @@ -371,7 +371,7 @@ describe("Batch Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_actors_connect0_node - MERGE (this1)<-[this1_actors_connect0_relationship:ACTED_IN]-(this1_actors_connect0_node) + CREATE (this1)<-[this1_actors_connect0_relationship:ACTED_IN]-(this1_actors_connect0_node) } } WITH this1, this1_actors_connect0_node diff --git a/packages/graphql/tests/tck/operations/connect.test.ts b/packages/graphql/tests/tck/operations/connect.test.ts index 34af2f891c..1fbf26b616 100644 --- a/packages/graphql/tests/tck/operations/connect.test.ts +++ b/packages/graphql/tests/tck/operations/connect.test.ts @@ -122,7 +122,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_colors_connect0_node - MERGE (this0)-[:HAS_COLOR]->(this0_colors_connect0_node) + CREATE (this0)-[:HAS_COLOR]->(this0_colors_connect0_node) } } WITH this0, this0_colors_connect0_node @@ -137,7 +137,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_colors_connect0_node UNWIND connectedNodes as this0_colors_connect0_node_photos0_node - MERGE (this0_colors_connect0_node)<-[:OF_COLOR]-(this0_colors_connect0_node_photos0_node) + CREATE (this0_colors_connect0_node)<-[:OF_COLOR]-(this0_colors_connect0_node_photos0_node) } } WITH this0, this0_colors_connect0_node, this0_colors_connect0_node_photos0_node @@ -152,7 +152,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_colors_connect0_node_photos0_node UNWIND connectedNodes as this0_colors_connect0_node_photos0_node_color0_node - MERGE (this0_colors_connect0_node_photos0_node)-[:OF_COLOR]->(this0_colors_connect0_node_photos0_node_color0_node) + CREATE (this0_colors_connect0_node_photos0_node)-[:OF_COLOR]->(this0_colors_connect0_node_photos0_node_color0_node) } } WITH this0, this0_colors_connect0_node, this0_colors_connect0_node_photos0_node, this0_colors_connect0_node_photos0_node_color0_node @@ -174,7 +174,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_photos_connect0_node - MERGE (this0)-[:HAS_PHOTO]->(this0_photos_connect0_node) + CREATE (this0)-[:HAS_PHOTO]->(this0_photos_connect0_node) } } WITH this0, this0_photos_connect0_node @@ -189,7 +189,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos_connect0_node UNWIND connectedNodes as this0_photos_connect0_node_color0_node - MERGE (this0_photos_connect0_node)-[:OF_COLOR]->(this0_photos_connect0_node_color0_node) + CREATE (this0_photos_connect0_node)-[:OF_COLOR]->(this0_photos_connect0_node_color0_node) } } WITH this0, this0_photos_connect0_node, this0_photos_connect0_node_color0_node @@ -209,7 +209,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_photos_connect1_node - MERGE (this0)-[:HAS_PHOTO]->(this0_photos_connect1_node) + CREATE (this0)-[:HAS_PHOTO]->(this0_photos_connect1_node) } } WITH this0, this0_photos_connect1_node @@ -224,7 +224,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos_connect1_node UNWIND connectedNodes as this0_photos_connect1_node_color0_node - MERGE (this0_photos_connect1_node)-[:OF_COLOR]->(this0_photos_connect1_node_color0_node) + CREATE (this0_photos_connect1_node)-[:OF_COLOR]->(this0_photos_connect1_node_color0_node) } } WITH this0, this0_photos_connect1_node, this0_photos_connect1_node_color0_node diff --git a/packages/graphql/tests/tck/operations/create.test.ts b/packages/graphql/tests/tck/operations/create.test.ts index f655935fea..bb6f739a04 100644 --- a/packages/graphql/tests/tck/operations/create.test.ts +++ b/packages/graphql/tests/tck/operations/create.test.ts @@ -328,7 +328,7 @@ describe("Cypher Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - MERGE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) + CREATE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) } } WITH this0, this0_actors_connect0_node @@ -391,7 +391,7 @@ describe("Cypher Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_movies_connect0_node - MERGE (this0)-[:ACTED_IN]->(this0_movies_connect0_node) + CREATE (this0)-[:ACTED_IN]->(this0_movies_connect0_node) } } WITH this0, this0_movies_connect0_node diff --git a/packages/graphql/tests/tck/operations/update.test.ts b/packages/graphql/tests/tck/operations/update.test.ts index e2fdc29efc..4dfa2cb3d1 100644 --- a/packages/graphql/tests/tck/operations/update.test.ts +++ b/packages/graphql/tests/tck/operations/update.test.ts @@ -281,7 +281,7 @@ describe("Cypher Update", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) } } WITH this, this_actors0_connect0_node @@ -337,7 +337,7 @@ describe("Cypher Update", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) } } WITH this, this_actors0_connect0_node @@ -355,7 +355,7 @@ describe("Cypher Update", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect1_node - MERGE (this)<-[this_actors0_connect1_relationship:ACTED_IN]-(this_actors0_connect1_node) + CREATE (this)<-[this_actors0_connect1_relationship:ACTED_IN]-(this_actors0_connect1_node) } } WITH this, this_actors0_connect1_node diff --git a/packages/graphql/tests/tck/pringles.test.ts b/packages/graphql/tests/tck/pringles.test.ts index 7077e17a72..5796159a02 100644 --- a/packages/graphql/tests/tck/pringles.test.ts +++ b/packages/graphql/tests/tck/pringles.test.ts @@ -153,7 +153,7 @@ describe("Cypher Create Pringles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos1_node UNWIND connectedNodes as this0_photos1_node_color_connect0_node - MERGE (this0_photos1_node)-[:OF_COLOR]->(this0_photos1_node_color_connect0_node) + CREATE (this0_photos1_node)-[:OF_COLOR]->(this0_photos1_node_color_connect0_node) } } WITH this0, this0_photos1_node, this0_photos1_node_color_connect0_node @@ -177,7 +177,7 @@ describe("Cypher Create Pringles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos2_node UNWIND connectedNodes as this0_photos2_node_color_connect0_node - MERGE (this0_photos2_node)-[:OF_COLOR]->(this0_photos2_node_color_connect0_node) + CREATE (this0_photos2_node)-[:OF_COLOR]->(this0_photos2_node_color_connect0_node) } } WITH this0, this0_photos2_node, this0_photos2_node_color_connect0_node @@ -286,7 +286,7 @@ describe("Cypher Create Pringles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_photos0 UNWIND connectedNodes as this_photos0_color0_connect0_node - MERGE (this_photos0)-[:OF_COLOR]->(this_photos0_color0_connect0_node) + CREATE (this_photos0)-[:OF_COLOR]->(this_photos0_color0_connect0_node) } } WITH this, this_photos0, this_photos0_color0_connect0_node diff --git a/packages/graphql/tests/tck/union.test.ts b/packages/graphql/tests/tck/union.test.ts index d39a6bcc1a..4e9565b827 100644 --- a/packages/graphql/tests/tck/union.test.ts +++ b/packages/graphql/tests/tck/union.test.ts @@ -338,7 +338,7 @@ describe("Cypher Union", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_search_Genre_connect0_node - MERGE (this0)-[:SEARCH]->(this0_search_Genre_connect0_node) + CREATE (this0)-[:SEARCH]->(this0_search_Genre_connect0_node) } } WITH this0, this0_search_Genre_connect0_node @@ -534,7 +534,7 @@ describe("Cypher Union", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_search_Genre0_connect0_node - MERGE (this)-[:SEARCH]->(this_search_Genre0_connect0_node) + CREATE (this)-[:SEARCH]->(this_search_Genre0_connect0_node) } } WITH this, this_search_Genre0_connect0_node From 24102cab05270170aed51dac42fe255e7c9b84b0 Mon Sep 17 00:00:00 2001 From: MacondoExpress Date: Thu, 9 Jan 2025 14:26:14 +0000 Subject: [PATCH 2/3] fix always connect bug --- .../interface-simple.int.test.ts | 147 +----------------- 1 file changed, 6 insertions(+), 141 deletions(-) diff --git a/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts b/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts index a177244631..6f4f940248 100644 --- a/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts +++ b/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts @@ -1333,8 +1333,7 @@ describe("interface with declared relationships", () => { ] ); }); - // FLAKY_TEST - // update -> connect -> edge + test("update interface relationship, connect edge", async () => { const actorName = "actor1"; const actorName2 = "actor2"; @@ -1352,7 +1351,11 @@ describe("interface with declared relationships", () => { const query = /* GraphQL */ ` mutation { - ${Actor.operations.update}(update: { + ${Actor.operations.update}( + where: { + name: { eq: "${actorName}" } + } + update: { actedIn: [{ # ActorActedInUpdateFieldInput where: { node: { title_EQ: "${movieTitle}" } } # ActorActedInConnectionWhere update: { # ActorActedInUpdateConnectionInput @@ -1468,20 +1471,6 @@ describe("interface with declared relationships", () => { }, properties: { screenTime: 111 }, }, - { - node: { - name: actorName3, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, - }, - ]), - }, - }, - properties: { screenTime: 111 }, - }, { node: { name: actorName, @@ -1596,130 +1585,6 @@ describe("interface with declared relationships", () => { ]), }, }, - { - name: actorName2, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { - title: movieTitle2, - actorsConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { - name: actorName2, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle2, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, - }, - ]), - }, - }, - properties: { screenTime: movieScreenTime }, - }, - { - node: { - name: actorName, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle2, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, - }, - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, - }, - { - node: { - title: seriesTitle, - episodeCount: seriesEpisodes, - }, - properties: { screenTime: movieScreenTime }, - }, - ]), - }, - }, - properties: { screenTime: movieScreenTime }, - }, - ]), - }, - }, - }, - ]), - }, - }, - { - name: actorName3, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { - title: movieTitle, - actorsConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { - name: actorName3, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, - }, - ]), - }, - }, - properties: { screenTime: 111 }, - }, - { - node: { - name: actorName3, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, - }, - ]), - }, - }, - properties: { screenTime: 111 }, - }, - { - node: { - name: actorName, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle2, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, - }, - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, - }, - { - node: { - title: seriesTitle, - episodeCount: seriesEpisodes, - }, - properties: { screenTime: movieScreenTime }, - }, - ]), - }, - }, - properties: { screenTime: movieScreenTime }, - }, - ]), - }, - }, - }, - ]), - }, - }, ] ); }); From f10a964227977092504a6d7e99d8626a9f8dd00e Mon Sep 17 00:00:00 2001 From: Michael Webb Date: Thu, 9 Jan 2025 16:07:58 +0100 Subject: [PATCH 3/3] test: update snapshots --- .../tck/deprecated/generic-filtering/roles-deprecated.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graphql/tests/tck/deprecated/generic-filtering/roles-deprecated.test.ts b/packages/graphql/tests/tck/deprecated/generic-filtering/roles-deprecated.test.ts index 8d3867ea82..441fd89ab5 100644 --- a/packages/graphql/tests/tck/deprecated/generic-filtering/roles-deprecated.test.ts +++ b/packages/graphql/tests/tck/deprecated/generic-filtering/roles-deprecated.test.ts @@ -452,7 +452,7 @@ describe("Cypher Auth Roles - deprecated", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) + CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -525,7 +525,7 @@ describe("Cypher Auth Roles - deprecated", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_post0 UNWIND connectedNodes as this_post0_creator0_connect0_node - MERGE (this_post0)-[:HAS_POST]->(this_post0_creator0_connect0_node) + CREATE (this_post0)-[:HAS_POST]->(this_post0_creator0_connect0_node) } } WITH this, this_post0, this_post0_creator0_connect0_node