diff --git a/__tests__/integration/__snapshots__/update.test.js.snap b/__tests__/integration/__snapshots__/update.test.js.snap index e19c736..ea982ff 100644 --- a/__tests__/integration/__snapshots__/update.test.js.snap +++ b/__tests__/integration/__snapshots__/update.test.js.snap @@ -746,6 +746,641 @@ GraphQLSchema { } `; +exports[`forward deeply nested mutation with nested updateByNodeId 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + +exports[`forward deeply nested update mutation with nested updateById 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + +exports[`forward deeply nested update mutation with nested updateById and connectById 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + +exports[`forward deeply nested update mutation with nested updateById and create 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + +exports[`forward deeply nested update mutation with nested updateById and deleteById 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + exports[`forward nested mutation during update 1`] = ` GraphQLSchema { "__validationErrors": Array [], @@ -1134,6 +1769,260 @@ GraphQLSchema { } `; +exports[`reverse deeply nested mutation with nested updateById 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + +exports[`reverse deeply nested mutation with nested updateByNodeId 1`] = ` +GraphQLSchema { + "__validationErrors": Array [], + "_directives": Array [ + "@include", + "@skip", + "@deprecated", + "@specifiedBy", + ], + "_implementationsMap": Object { + "Node": Object { + "interfaces": Array [], + "objects": Array [ + "Query", + "Child", + "Parent", + "Grandchild", + ], + }, + }, + "_mutationType": "Mutation", + "_queryType": "Query", + "_subTypeMap": Object {}, + "_subscriptionType": undefined, + "_typeMap": Object { + "Boolean": "Boolean", + "Child": "Child", + "ChildChildPkeyConnect": "ChildChildPkeyConnect", + "ChildChildPkeyDelete": "ChildChildPkeyDelete", + "ChildCondition": "ChildCondition", + "ChildInput": "ChildInput", + "ChildNodeIdConnect": "ChildNodeIdConnect", + "ChildNodeIdDelete": "ChildNodeIdDelete", + "ChildOnChildForChildParentFkeyNodeIdUpdate": "ChildOnChildForChildParentFkeyNodeIdUpdate", + "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate": "ChildOnChildForChildParentFkeyUsingChildPkeyUpdate", + "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "ChildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate": "ChildOnGrandchildForGrandchildChildFkeyUsingChildPkeyUpdate", + "ChildParentFkeyChildCreateInput": "ChildParentFkeyChildCreateInput", + "ChildParentFkeyInput": "ChildParentFkeyInput", + "ChildParentFkeyInverseInput": "ChildParentFkeyInverseInput", + "ChildParentFkeyParentCreateInput": "ChildParentFkeyParentCreateInput", + "ChildPatch": "ChildPatch", + "ChildrenConnection": "ChildrenConnection", + "ChildrenEdge": "ChildrenEdge", + "ChildrenOrderBy": "ChildrenOrderBy", + "CreateChildInput": "CreateChildInput", + "CreateChildPayload": "CreateChildPayload", + "CreateGrandchildInput": "CreateGrandchildInput", + "CreateGrandchildPayload": "CreateGrandchildPayload", + "CreateParentInput": "CreateParentInput", + "CreateParentPayload": "CreateParentPayload", + "Cursor": "Cursor", + "DeleteChildByIdInput": "DeleteChildByIdInput", + "DeleteChildInput": "DeleteChildInput", + "DeleteChildPayload": "DeleteChildPayload", + "DeleteGrandchildByIdInput": "DeleteGrandchildByIdInput", + "DeleteGrandchildInput": "DeleteGrandchildInput", + "DeleteGrandchildPayload": "DeleteGrandchildPayload", + "DeleteParentByIdInput": "DeleteParentByIdInput", + "DeleteParentInput": "DeleteParentInput", + "DeleteParentPayload": "DeleteParentPayload", + "Grandchild": "Grandchild", + "GrandchildChildFkeyChildCreateInput": "GrandchildChildFkeyChildCreateInput", + "GrandchildChildFkeyGrandchildCreateInput": "GrandchildChildFkeyGrandchildCreateInput", + "GrandchildChildFkeyInput": "GrandchildChildFkeyInput", + "GrandchildChildFkeyInverseInput": "GrandchildChildFkeyInverseInput", + "GrandchildCondition": "GrandchildCondition", + "GrandchildGrandchildPkeyConnect": "GrandchildGrandchildPkeyConnect", + "GrandchildGrandchildPkeyDelete": "GrandchildGrandchildPkeyDelete", + "GrandchildInput": "GrandchildInput", + "GrandchildNodeIdConnect": "GrandchildNodeIdConnect", + "GrandchildNodeIdDelete": "GrandchildNodeIdDelete", + "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyNodeIdUpdate", + "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate": "GrandchildOnGrandchildForGrandchildChildFkeyUsingGrandchildPkeyUpdate", + "GrandchildPatch": "GrandchildPatch", + "GrandchildrenConnection": "GrandchildrenConnection", + "GrandchildrenEdge": "GrandchildrenEdge", + "GrandchildrenOrderBy": "GrandchildrenOrderBy", + "ID": "ID", + "Int": "Int", + "Mutation": "Mutation", + "Node": "Node", + "PageInfo": "PageInfo", + "Parent": "Parent", + "ParentCondition": "ParentCondition", + "ParentInput": "ParentInput", + "ParentNodeIdConnect": "ParentNodeIdConnect", + "ParentNodeIdDelete": "ParentNodeIdDelete", + "ParentOnChildForChildParentFkeyNodeIdUpdate": "ParentOnChildForChildParentFkeyNodeIdUpdate", + "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate": "ParentOnChildForChildParentFkeyUsingParentPkeyUpdate", + "ParentParentPkeyConnect": "ParentParentPkeyConnect", + "ParentParentPkeyDelete": "ParentParentPkeyDelete", + "ParentPatch": "ParentPatch", + "ParentsConnection": "ParentsConnection", + "ParentsEdge": "ParentsEdge", + "ParentsOrderBy": "ParentsOrderBy", + "Query": "Query", + "String": "String", + "UpdateChildByIdInput": "UpdateChildByIdInput", + "UpdateChildInput": "UpdateChildInput", + "UpdateChildPayload": "UpdateChildPayload", + "UpdateGrandchildByIdInput": "UpdateGrandchildByIdInput", + "UpdateGrandchildInput": "UpdateGrandchildInput", + "UpdateGrandchildPayload": "UpdateGrandchildPayload", + "UpdateParentByIdInput": "UpdateParentByIdInput", + "UpdateParentInput": "UpdateParentInput", + "UpdateParentPayload": "UpdateParentPayload", + "__Directive": "__Directive", + "__DirectiveLocation": "__DirectiveLocation", + "__EnumValue": "__EnumValue", + "__Field": "__Field", + "__InputValue": "__InputValue", + "__Schema": "__Schema", + "__Type": "__Type", + "__TypeKind": "__TypeKind", + "updateChildOnChildForChildParentFkeyPatch": "updateChildOnChildForChildParentFkeyPatch", + "updateChildOnGrandchildForGrandchildChildFkeyPatch": "updateChildOnGrandchildForGrandchildChildFkeyPatch", + "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch": "updateGrandchildOnGrandchildForGrandchildChildFkeyPatch", + "updateParentOnChildForChildParentFkeyPatch": "updateParentOnChildForChildParentFkeyPatch", + }, + "astNode": undefined, + "description": undefined, + "extensionASTNodes": undefined, + "extensions": undefined, +} +`; + exports[`reverse nested mutation with nested update 1`] = ` GraphQLSchema { "__validationErrors": Array [], diff --git a/__tests__/integration/update.test.js b/__tests__/integration/update.test.js index c8949ca..3c065fe 100644 --- a/__tests__/integration/update.test.js +++ b/__tests__/integration/update.test.js @@ -130,8 +130,11 @@ test( data.childrenByParentId.nodes.map((n) => expect(n.parentId).toBe(data.id), ); - expect(data.childrenByParentId.nodes.map(n => n.id)) - .toEqual([95, 98, 99]); + expect(data.childrenByParentId.nodes.map((n) => n.id)).toEqual([ + 95, + 98, + 99, + ]); }, }), ); @@ -279,8 +282,12 @@ test( data.childrenByParentId.nodes.map((n) => expect(n.parentId).toBe(data.id), ); - expect(data.childrenByParentId.nodes.map(n => n.id)) - .toEqual([95, 97, 98, 99]); + expect(data.childrenByParentId.nodes.map((n) => n.id)).toEqual([ + 95, + 97, + 98, + 99, + ]); }, }), ); @@ -358,8 +365,9 @@ test( const result = await graphql(schema, query, null, { pgClient }); expect(result).toHaveProperty('errors'); - expect(result.errors[0].message) - .toMatch(/"deleteByNodeId" is not defined/); + expect(result.errors[0].message).toMatch( + /"deleteByNodeId" is not defined/, + ); }, }), ); @@ -1082,3 +1090,760 @@ test( }, }), ); + +test( + 'forward deeply nested update mutation with nested updateById and create', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child 1'); + `, + test: async ({ schema, pgClient }) => { + const query = ` + mutation { + updateParentById( + input: { + id: 1 + parentPatch: { + name: "updated parent" + childrenUsingId: { + updateById: { + id: 1 + childPatch: { + name: "updated child 1" + grandchildrenUsingId: { + create: [{ name: "grandchild 1 of child 1" }] + } + } + } + } + } + } + ) { + parent { + id + name + childrenByParentId { + nodes { + id + parentId + name + grandchildrenByChildId { + nodes { + id + childId + name + } + } + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const { data } = result; + + expect(data.updateParentById.parent.name).toEqual('updated parent'); + data.updateParentById.parent.childrenByParentId.nodes.map((n) => + expect(n.parentId).toBe(data.updateParentById.parent.id), + ); + + expect( + data.updateParentById.parent.childrenByParentId.nodes, + ).toHaveLength(1); + expect( + data.updateParentById.parent.childrenByParentId.nodes[0].name, + ).toEqual('updated child 1'); + + expect( + data.updateParentById.parent.childrenByParentId.nodes[0] + .grandchildrenByChildId.nodes, + ).toHaveLength(1); + expect( + data.updateParentById.parent.childrenByParentId.nodes[0] + .grandchildrenByChildId.nodes[0].name, + ).toEqual('grandchild 1 of child 1'); + }, + }), +); + +test( + 'forward deeply nested update mutation with nested updateById', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child 1'); + insert into p.grandchild values(1, 1, 'test grandchild 1'); + `, + test: async ({ schema, pgClient }) => { + const query = ` + mutation { + updateParentById( + input: { + id: 1 + parentPatch: { + name: "updated parent" + childrenUsingId: { + updateById: { + id: 1 + childPatch: { + name: "updated child 1" + grandchildrenUsingId: { + updateById: { + id: 1 + grandchildPatch: { + name: "updated grandchild 1 of child 1" + } + } + } + } + } + } + } + } + ) { + parent { + id + name + childrenByParentId { + nodes { + id + parentId + name + grandchildrenByChildId { + nodes { + id + childId + name + } + } + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const { data } = result; + + expect(data.updateParentById.parent.name).toEqual(`updated parent`); + data.updateParentById.parent.childrenByParentId.nodes.map((n) => + expect(n.parentId).toBe(data.updateParentById.parent.id), + ); + + expect( + data.updateParentById.parent.childrenByParentId.nodes, + ).toHaveLength(1); + expect( + data.updateParentById.parent.childrenByParentId.nodes[0].name, + ).toEqual('updated child 1'); + + expect( + data.updateParentById.parent.childrenByParentId.nodes[0] + .grandchildrenByChildId.nodes, + ).toHaveLength(1); + expect( + data.updateParentById.parent.childrenByParentId.nodes[0] + .grandchildrenByChildId.nodes[0].name, + ).toEqual('updated grandchild 1 of child 1'); + }, + }), +); + +test( + 'forward deeply nested update mutation with nested updateById and connectById', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child 1'); + insert into p.child values(2, 1, 'test child 2'); + insert into p.grandchild values(1, 1, 'test grandchild 1'); + `, + test: async ({ schema, pgClient }) => { + const query = ` + mutation { + updateParentById( + input: { + id: 1 + parentPatch: { + name: "updated parent" + childrenUsingId: { + updateById: { + id: 1 + childPatch: { + name: "updated child 1" + grandchildrenUsingId: { + updateById: { + id: 1 + grandchildPatch: { + childToChildId: { + connectById: { id: 2 } + } + name: "changed parent of grandchild 1" + } + } + } + } + } + } + } + } + ) { + parent { + id + name + childrenByParentId { + nodes { + id + parentId + name + grandchildrenByChildId { + nodes { + id + childId + name + } + } + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const { data } = result; + + expect(data.updateParentById.parent.name).toEqual(`updated parent`); + data.updateParentById.parent.childrenByParentId.nodes.map((n) => + expect(n.parentId).toBe(data.updateParentById.parent.id), + ); + + expect( + data.updateParentById.parent.childrenByParentId.nodes, + ).toHaveLength(2); + expect( + data.updateParentById.parent.childrenByParentId.nodes[0].name, + ).toEqual('updated child 1'); + expect( + data.updateParentById.parent.childrenByParentId.nodes[1].name, + ).toEqual('test child 2'); + + expect( + data.updateParentById.parent.childrenByParentId.nodes[1] + .grandchildrenByChildId.nodes, + ).toHaveLength(1); + expect( + data.updateParentById.parent.childrenByParentId.nodes[1] + .grandchildrenByChildId.nodes[0].childId, + ).toEqual(2); + expect( + data.updateParentById.parent.childrenByParentId.nodes[1] + .grandchildrenByChildId.nodes[0].name, + ).toEqual('changed parent of grandchild 1'); + }, + }), +); + +test( + 'forward deeply nested update mutation with nested updateById and deleteById', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child 1'); + insert into p.child values(2, 1, 'test child 2'); + insert into p.grandchild values(1, 1, 'test grandchild 1'); + `, + test: async ({ schema, pgClient }) => { + const query = ` + mutation { + updateParentById( + input: { + id: 1 + parentPatch: { + name: "updated parent" + childrenUsingId: { + updateById: { + id: 1 + childPatch: { + name: "updated child 1" + grandchildrenUsingId: { + deleteById: { + id: 1 + } + } + } + } + } + } + } + ) { + parent { + id + name + childrenByParentId { + nodes { + id + parentId + name + grandchildrenByChildId { + nodes { + id + childId + name + } + } + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const { data } = result; + + expect(data.updateParentById.parent.name).toEqual(`updated parent`); + data.updateParentById.parent.childrenByParentId.nodes.map((n) => + expect(n.parentId).toBe(data.updateParentById.parent.id), + ); + + expect( + data.updateParentById.parent.childrenByParentId.nodes, + ).toHaveLength(2); + expect( + data.updateParentById.parent.childrenByParentId.nodes[0].name, + ).toEqual('updated child 1'); + expect( + data.updateParentById.parent.childrenByParentId.nodes[1].name, + ).toEqual('test child 2'); + + expect( + data.updateParentById.parent.childrenByParentId.nodes[1] + .grandchildrenByChildId.nodes, + ).toHaveLength(0); + }, + }), +); + +test( + 'forward deeply nested mutation with nested updateByNodeId', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child'); + insert into p.grandchild values(1, 1, 'test grandchild'); + `, + test: async ({ schema, pgClient }) => { + const lookupChildQuery = ` + query { + childById(id: 1) { + nodeId + } + } + `; + const lookupChildResult = await graphql(schema, lookupChildQuery, null, { + pgClient, + }); + const { nodeId: childNodeId } = lookupChildResult.data.childById; + expect(childNodeId).not.toBeUndefined(); + + const lookupGrandchildQuery = ` + query { + grandchildById(id: 1) { + nodeId + } + } + `; + const lookupGrandchildResult = await graphql( + schema, + lookupGrandchildQuery, + null, + { + pgClient, + }, + ); + const { + nodeId: grandchildNodeId, + } = lookupGrandchildResult.data.grandchildById; + expect(grandchildNodeId).not.toBeUndefined(); + + const query = ` + mutation { + updateParentById( + input: { + id: 1 + parentPatch: { + childrenUsingId: { + updateByNodeId: { + nodeId: "${childNodeId}" + childPatch: { + name: "renamed child" + grandchildrenUsingId: { + updateByNodeId: { + nodeId: "${grandchildNodeId}" + grandchildPatch: { + name: "renamed grandchild" + } + } + } + } + } + } + } + } + ) { + parent { + id + name + childrenByParentId { + nodes { + id + parentId + name + grandchildrenByChildId { + nodes { + id + childId + name + } + } + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const childData = result.data.updateParentById.parent; + expect(childData.childrenByParentId.nodes).toHaveLength(1); + childData.childrenByParentId.nodes.map((n) => + expect(n.parentId).toBe(childData.id), + ); + expect(childData.childrenByParentId.nodes[0].name).toEqual( + 'renamed child', + ); + + const grandchildData = childData.childrenByParentId.nodes[0]; + expect(grandchildData.grandchildrenByChildId.nodes).toHaveLength(1); + grandchildData.grandchildrenByChildId.nodes.map((n) => + expect(n.childId).toBe(grandchildData.id), + ); + expect(grandchildData.grandchildrenByChildId.nodes[0].name).toEqual( + 'renamed grandchild', + ); + }, + }), +); + +test( + 'reverse deeply nested mutation with nested updateById', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child'); + insert into p.grandchild values(1, 1, 'test grandchild'); + `, + test: async ({ schema, pgClient }) => { + const query = ` + mutation { + updateGrandchildById( + input: { + id: 1 + grandchildPatch: { + childToChildId: { + updateById: { + id: 1 + childPatch: { + parentToParentId: { + updateById: { id: 1, parentPatch: { name: "renamed parent" } } + } + } + } + } + } + } + ) { + grandchild { + id + name + childByChildId { + id + name + parentByParentId { + id + name + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const child = result.data.updateGrandchildById.grandchild.childByChildId; + expect(child.parentByParentId).not.toBeNull(); + expect(child.parentByParentId.name).toEqual('renamed parent'); + }, + }), +); + +test( + 'reverse deeply nested mutation with nested updateByNodeId', + withSchema({ + setup: ` + create table p.parent ( + id serial primary key, + name text not null + ); + + create table p.child ( + id serial primary key, + parent_id integer, + name text not null, + constraint child_parent_fkey foreign key (parent_id) + references p.parent (id) + ); + + create table p.grandchild ( + id serial primary key, + child_id integer not null, + name text not null, + constraint grandchild_child_fkey foreign key (child_id) + references p.child (id) + ); + + insert into p.parent values(1, 'test parent'); + insert into p.child values(1, 1, 'test child'); + insert into p.grandchild values(1, 1, 'test grandchild'); + `, + test: async ({ schema, pgClient }) => { + const lookupParentQuery = ` + query { + parentById(id: 1) { + nodeId + } + } + `; + const lookupParentResult = await graphql( + schema, + lookupParentQuery, + null, + { + pgClient, + }, + ); + const { nodeId: parentNodeId } = lookupParentResult.data.parentById; + expect(parentNodeId).not.toBeUndefined(); + + const lookupChildQuery = ` + query { + childById(id: 1) { + nodeId + } + } + `; + const lookupChildResult = await graphql(schema, lookupChildQuery, null, { + pgClient, + }); + const { nodeId: childNodeId } = lookupChildResult.data.childById; + expect(childNodeId).not.toBeUndefined(); + + const query = ` + mutation { + updateGrandchildById( + input: { + id: 1 + grandchildPatch: { + childToChildId: { + updateByNodeId: { + nodeId: "${childNodeId}" + childPatch: { + parentToParentId: { + updateByNodeId: { + nodeId: "${parentNodeId}" + parentPatch: { + name: "renamed parent" + } + } + } + } + } + } + } + } + ) { + grandchild { + id + name + childByChildId { + id + name + parentByParentId { + id + name + } + } + } + } + } + `; + expect(schema).toMatchSnapshot(); + + const result = await graphql(schema, query, null, { pgClient }); + expect(result).not.toHaveProperty('errors'); + + const child = result.data.updateGrandchildById.grandchild.childByChildId; + expect(child.parentByParentId).not.toBeNull(); + expect(child.parentByParentId.name).toEqual('renamed parent'); + }, + }), +); diff --git a/src/PostgraphileNestedMutationsPlugin.js b/src/PostgraphileNestedMutationsPlugin.js index c4aa384..11661f6 100644 --- a/src/PostgraphileNestedMutationsPlugin.js +++ b/src/PostgraphileNestedMutationsPlugin.js @@ -66,7 +66,8 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { pgQueryFromResolveData: queryFromResolveData, pgNestedPluginForwardInputTypes, pgNestedPluginReverseInputTypes, - pgNestedResolvers, + pgNestedCreateResolvers, + pgNestedUpdateResolvers, pgNestedTableConnectorFields, pgNestedTableConnect, pgNestedTableDeleterFields, @@ -81,7 +82,6 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { scope: { isPgCreateMutationField, isPgUpdateMutationField, - isPgNodeMutation, pgFieldIntrospection: table, pgFieldConstraint, }, @@ -97,7 +97,7 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { !pgNestedPluginForwardInputTypes[table.id] && !pgNestedPluginReverseInputTypes[table.id] ) { - pgNestedResolvers[table.id] = field.resolve; + pgNestedCreateResolvers[table.id] = field.resolve; return field; } @@ -141,6 +141,41 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { } = nestedField; const fieldValue = input[fieldName]; + if (fieldValue.updateById || fieldValue.updateByNodeId) { + await Promise.all( + Object.keys(fieldValue).map(async (k) => { + (Array.isArray(fieldValue[k]) + ? fieldValue[k] + : [fieldValue[k]] + ).map(async (rowData) => { + const updateData = Object.assign( + {}, + rowData, + await recurseForwardNestedMutations( + data, + { input: rowData }, + { pgClient }, + resolveInfo, + ), + ); + + const resolver = pgNestedUpdateResolvers[foreignTable.id]; + const resolveResult = await resolver( + data, + { input: updateData }, + { pgClient }, + resolveInfo, + ); + + foreignKeys.forEach((pk, idx) => { + output[inflection.column(keys[idx])] = + resolveResult.data[`__pk__${pk.name}`]; + }); + }); + }), + ); + } + await Promise.all( pgNestedTableConnectorFields[foreignTable.id] .filter((f) => fieldValue[f.fieldName]) @@ -207,7 +242,7 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { if (fieldValue.create) { const createData = fieldValue.create; - const resolver = pgNestedResolvers[foreignTable.id]; + const resolver = pgNestedCreateResolvers[foreignTable.id]; const tableVar = inflection.tableFieldName(foreignTable); const insertData = Object.assign( @@ -238,7 +273,12 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { return output; }; - const newResolver = async (data, { input }, { pgClient }, resolveInfo) => { + const mutationResolver = async ( + data, + { input }, + { pgClient }, + resolveInfo, + ) => { const PayloadType = getTypeByName( isPgUpdateMutationField ? inflection.updatePayloadType(table) @@ -308,9 +348,9 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { const sqlColumns = []; const sqlValues = []; let condition = null; + const nodeId = input[nodeIdFieldName]; - if (isPgNodeMutation) { - const nodeId = input[nodeIdFieldName]; + if (nodeId) { try { const { Type, identifiers } = getTypeAndIdentifiersFromNodeId( nodeId, @@ -580,7 +620,7 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { if (fieldValue.create) { await Promise.all( fieldValue.create.map(async (rowData) => { - const resolver = pgNestedResolvers[foreignTable.id]; + const resolver = pgNestedCreateResolvers[foreignTable.id]; const tableVar = inflection.tableFieldName(foreignTable); const keyData = {}; @@ -610,6 +650,42 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { }), ); } + + if (fieldValue.updateById || fieldValue.updateByNodeId) { + await Promise.all( + Object.keys(fieldValue) + .filter((f) => fieldValue[f]) + .map(async (f) => { + await Promise.all( + (Array.isArray(fieldValue[f]) + ? fieldValue[f] + : [fieldValue[f]] + ).map(async (rowData) => { + const resolver = + pgNestedUpdateResolvers[foreignTable.id]; + + const { data: reverseRow } = await resolver( + data, + { + input: Object.assign({}, rowData), + }, + { pgClient }, + resolveInfo, + ); + + const rowKeyValues = {}; + if (primaryKeys && reverseRow) { + primaryKeys.forEach((k) => { + rowKeyValues[k.name] = + reverseRow[`__pk__${k.name}`]; + }); + } + modifiedRows.push(rowKeyValues); + }), + ); + }), + ); + } }), ); @@ -655,9 +731,13 @@ module.exports = function PostGraphileNestedMutationPlugin(builder) { }; if (isPgCreateMutationField) { - pgNestedResolvers[table.id] = newResolver; + pgNestedCreateResolvers[table.id] = mutationResolver; + } + + if (isPgUpdateMutationField) { + pgNestedUpdateResolvers[table.id] = mutationResolver; } - return Object.assign({}, field, { resolve: newResolver }); + return Object.assign({}, field, { resolve: mutationResolver }); }); }; diff --git a/src/PostgraphileNestedTypesPlugin.js b/src/PostgraphileNestedTypesPlugin.js index 16ecacc..9569128 100644 --- a/src/PostgraphileNestedTypesPlugin.js +++ b/src/PostgraphileNestedTypesPlugin.js @@ -41,7 +41,8 @@ module.exports = function PostGraphileNestedTypesPlugin( return extend(build, { pgNestedPluginForwardInputTypes: {}, pgNestedPluginReverseInputTypes: {}, - pgNestedResolvers: {}, + pgNestedCreateResolvers: {}, + pgNestedUpdateResolvers: {}, pgNestedFieldName(options) { const { constraint: {