From c8e1afe5537ff09b4ad11e100765f583d23eb692 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Tue, 15 Jun 2021 12:57:07 +0100 Subject: [PATCH 1/4] Missing copyright headers --- .../get-relationship-field-meta.test.ts | 19 +++++++++++++++++++ .../graphql/src/schema/get-where-fields.ts | 19 +++++++++++++++++++ .../create-connection-and-params.test.ts | 19 +++++++++++++++++++ .../create-connection-and-params.ts | 19 +++++++++++++++++++ ...-set-relationship-properties-and-params.ts | 19 +++++++++++++++++++ .../create-set-relationship-properties.ts | 19 +++++++++++++++++++ .../elements/create-datetime-element.test.ts | 19 +++++++++++++++++++ .../elements/create-datetime-element.ts | 19 +++++++++++++++++++ .../elements/create-point-element.test.ts | 19 +++++++++++++++++++ .../elements/create-point-element.ts | 19 +++++++++++++++++++ ...eate-relationship-property-element.test.ts | 19 +++++++++++++++++++ .../create-relationship-property-element.ts | 19 +++++++++++++++++++ .../create-connection-where-and-params.ts | 19 +++++++++++++++++++ .../src/translate/where/create-filter.test.ts | 19 +++++++++++++++++++ .../src/translate/where/create-filter.ts | 19 +++++++++++++++++++ .../create-relationship-where-and-params.ts | 19 +++++++++++++++++++ 16 files changed, 304 insertions(+) diff --git a/packages/graphql/src/schema/get-relationship-field-meta.test.ts b/packages/graphql/src/schema/get-relationship-field-meta.test.ts index 5df75cf4ca..25dc5e6e67 100644 --- a/packages/graphql/src/schema/get-relationship-field-meta.test.ts +++ b/packages/graphql/src/schema/get-relationship-field-meta.test.ts @@ -1,3 +1,22 @@ +/* + * 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 { mergeTypeDefs } from "@graphql-tools/merge"; import { InterfaceTypeDefinitionNode } from "graphql"; import getRelationshipFieldMeta from "./get-relationship-field-meta"; diff --git a/packages/graphql/src/schema/get-where-fields.ts b/packages/graphql/src/schema/get-where-fields.ts index 0f9fffb98c..a8e62eef63 100644 --- a/packages/graphql/src/schema/get-where-fields.ts +++ b/packages/graphql/src/schema/get-where-fields.ts @@ -1,3 +1,22 @@ +/* + * 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 { CustomEnumField, CustomScalarField, DateTimeField, PointField, PrimitiveField } from "../types"; interface Fields { diff --git a/packages/graphql/src/translate/connection/create-connection-and-params.test.ts b/packages/graphql/src/translate/connection/create-connection-and-params.test.ts index 5212760edc..4de82883c3 100644 --- a/packages/graphql/src/translate/connection/create-connection-and-params.test.ts +++ b/packages/graphql/src/translate/connection/create-connection-and-params.test.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import dedent from "dedent"; import { mocked } from "ts-jest/utils"; diff --git a/packages/graphql/src/translate/connection/create-connection-and-params.ts b/packages/graphql/src/translate/connection/create-connection-and-params.ts index 7cd91aa021..619750426d 100644 --- a/packages/graphql/src/translate/connection/create-connection-and-params.ts +++ b/packages/graphql/src/translate/connection/create-connection-and-params.ts @@ -1,3 +1,22 @@ +/* + * 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 { FieldsByTypeName, ResolveTree } from "graphql-parse-resolve-info"; import { ConnectionField, ConnectionOptionsArg, ConnectionWhereArg, Context } from "../../types"; import { Node } from "../../classes"; diff --git a/packages/graphql/src/translate/create-set-relationship-properties-and-params.ts b/packages/graphql/src/translate/create-set-relationship-properties-and-params.ts index 0cdf656f09..395bc8f280 100644 --- a/packages/graphql/src/translate/create-set-relationship-properties-and-params.ts +++ b/packages/graphql/src/translate/create-set-relationship-properties-and-params.ts @@ -1,3 +1,22 @@ +/* + * 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. + */ + /* eslint-disable prefer-destructuring */ import { Relationship } from "../classes"; import { BaseField, DateTimeField, PrimitiveField } from "../types"; diff --git a/packages/graphql/src/translate/create-set-relationship-properties.ts b/packages/graphql/src/translate/create-set-relationship-properties.ts index ad447a2ea5..6497898cb5 100644 --- a/packages/graphql/src/translate/create-set-relationship-properties.ts +++ b/packages/graphql/src/translate/create-set-relationship-properties.ts @@ -1,3 +1,22 @@ +/* + * 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 { Relationship } from "../classes"; import { BaseField, DateTimeField, PrimitiveField } from "../types"; diff --git a/packages/graphql/src/translate/projection/elements/create-datetime-element.test.ts b/packages/graphql/src/translate/projection/elements/create-datetime-element.test.ts index 14fbcc208e..be1dbd669b 100644 --- a/packages/graphql/src/translate/projection/elements/create-datetime-element.test.ts +++ b/packages/graphql/src/translate/projection/elements/create-datetime-element.test.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import { DateTimeField } from "../../../types"; import createDatetimeElement from "./create-datetime-element"; diff --git a/packages/graphql/src/translate/projection/elements/create-datetime-element.ts b/packages/graphql/src/translate/projection/elements/create-datetime-element.ts index 59d930680a..20e5facb6d 100644 --- a/packages/graphql/src/translate/projection/elements/create-datetime-element.ts +++ b/packages/graphql/src/translate/projection/elements/create-datetime-element.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import { DateTimeField } from "../../../types"; diff --git a/packages/graphql/src/translate/projection/elements/create-point-element.test.ts b/packages/graphql/src/translate/projection/elements/create-point-element.test.ts index 151452c88b..3a0116f4fc 100644 --- a/packages/graphql/src/translate/projection/elements/create-point-element.test.ts +++ b/packages/graphql/src/translate/projection/elements/create-point-element.test.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import { PointField } from "../../../types"; import createPointElement from "./create-point-element"; diff --git a/packages/graphql/src/translate/projection/elements/create-point-element.ts b/packages/graphql/src/translate/projection/elements/create-point-element.ts index 0d28785e00..3bfe861de9 100644 --- a/packages/graphql/src/translate/projection/elements/create-point-element.ts +++ b/packages/graphql/src/translate/projection/elements/create-point-element.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import { PointField } from "../../../types"; diff --git a/packages/graphql/src/translate/projection/elements/create-relationship-property-element.test.ts b/packages/graphql/src/translate/projection/elements/create-relationship-property-element.test.ts index 82b2664654..0cbc895606 100644 --- a/packages/graphql/src/translate/projection/elements/create-relationship-property-element.test.ts +++ b/packages/graphql/src/translate/projection/elements/create-relationship-property-element.test.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import Relationship from "../../../classes/Relationship"; import { DateTimeField, PointField, PrimitiveField } from "../../../types"; diff --git a/packages/graphql/src/translate/projection/elements/create-relationship-property-element.ts b/packages/graphql/src/translate/projection/elements/create-relationship-property-element.ts index 4bf839dbea..791b5bf36b 100644 --- a/packages/graphql/src/translate/projection/elements/create-relationship-property-element.ts +++ b/packages/graphql/src/translate/projection/elements/create-relationship-property-element.ts @@ -1,3 +1,22 @@ +/* + * 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 { ResolveTree } from "graphql-parse-resolve-info"; import Relationship from "../../../classes/Relationship"; import createDatetimeElement from "./create-datetime-element"; diff --git a/packages/graphql/src/translate/where/create-connection-where-and-params.ts b/packages/graphql/src/translate/where/create-connection-where-and-params.ts index d7832dc2d4..35e7f2f5b2 100644 --- a/packages/graphql/src/translate/where/create-connection-where-and-params.ts +++ b/packages/graphql/src/translate/where/create-connection-where-and-params.ts @@ -1,3 +1,22 @@ +/* + * 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 { Node, Relationship } from "../../classes"; import { ConnectionWhereArg, Context } from "../../types"; import createRelationshipWhereAndParams from "./create-relationship-where-and-params"; diff --git a/packages/graphql/src/translate/where/create-filter.test.ts b/packages/graphql/src/translate/where/create-filter.test.ts index 9770c8b091..ea57776122 100644 --- a/packages/graphql/src/translate/where/create-filter.test.ts +++ b/packages/graphql/src/translate/where/create-filter.test.ts @@ -1,3 +1,22 @@ +/* + * 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 createFilter, { Operator } from "./create-filter"; describe("createFilter", () => { diff --git a/packages/graphql/src/translate/where/create-filter.ts b/packages/graphql/src/translate/where/create-filter.ts index 4030ee4e84..372797c1cf 100644 --- a/packages/graphql/src/translate/where/create-filter.ts +++ b/packages/graphql/src/translate/where/create-filter.ts @@ -1,3 +1,22 @@ +/* + * 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. + */ + export enum Operator { INCLUDES = "IN", IN = "IN", diff --git a/packages/graphql/src/translate/where/create-relationship-where-and-params.ts b/packages/graphql/src/translate/where/create-relationship-where-and-params.ts index 327ad8d34b..cf0e811a08 100644 --- a/packages/graphql/src/translate/where/create-relationship-where-and-params.ts +++ b/packages/graphql/src/translate/where/create-relationship-where-and-params.ts @@ -1,3 +1,22 @@ +/* + * 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 Relationship from "../../classes/Relationship"; import { GraphQLWhereArg, Context, PrimitiveField } from "../../types"; import createFilter from "./create-filter"; From 900bb4bb5d92520bc29c6568c726379c56cabb35 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Tue, 15 Jun 2021 13:00:28 +0100 Subject: [PATCH 2/4] Point to prerelease documentation for 2.0.0 branch --- README.md | 3 ++- packages/graphql/README.md | 2 +- packages/ogm/README.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1878aec0d7..acc57d8091 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ 💡 Welcome to the Monorepo for [Neo4j](https://neo4j.com/) + [GraphQL](https://graphql.org/). ![Neo4j + GraphQL](./docs/images/banner.png) +

Discord @@ -18,7 +19,7 @@ Want to contribute to `@neo4j/graphql`? See our [contributing guide](./docs/mark ## Links -1. [Documentation](https://neo4j.com/docs/graphql-manual/current/) +1. [Documentation](https://neo4j.com/docs/graphql-manual/2.0/) 2. [Discord](https://discord.gg/neo4j) 3. [Examples](./examples) diff --git a/packages/graphql/README.md b/packages/graphql/README.md index 454493b72b..19d8936047 100644 --- a/packages/graphql/README.md +++ b/packages/graphql/README.md @@ -14,7 +14,7 @@ A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations. -1. [Documentation](https://neo4j.com/docs/graphql-manual/current/) +1. [Documentation](https://neo4j.com/docs/graphql-manual/2.0/) ## Installation diff --git a/packages/ogm/README.md b/packages/ogm/README.md index 2206abf1db..05de511b66 100644 --- a/packages/ogm/README.md +++ b/packages/ogm/README.md @@ -14,7 +14,7 @@ GraphQL powered OGM for Neo4j and Javascript applications. -1. [Documentation](https://neo4j.com/docs/graphql-manual/current/) +1. [Documentation](https://neo4j.com/docs/graphql-manual/2.0/ogm/) ## Installation From 20ff60f55c4ffe7e13688e074c51d5feda4d5801 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Tue, 15 Jun 2021 13:11:56 +0100 Subject: [PATCH 3/4] General housekeeping before release --- .../graphql/src/schema/get-where-fields.ts | 7 --- .../src/schema/make-augmented-schema.ts | 32 +---------- .../create-connection-and-params.ts | 53 ------------------- .../src/translate/create-delete-and-params.ts | 4 +- .../graphql/src/translate/translate-update.ts | 3 -- .../create-connection-where-and-params.ts | 7 --- .../where/create-node-where-and-params.ts | 11 ---- .../create-relationship-where-and-params.ts | 1 - 8 files changed, 3 insertions(+), 115 deletions(-) diff --git a/packages/graphql/src/schema/get-where-fields.ts b/packages/graphql/src/schema/get-where-fields.ts index a8e62eef63..2d32cdb0f7 100644 --- a/packages/graphql/src/schema/get-where-fields.ts +++ b/packages/graphql/src/schema/get-where-fields.ts @@ -38,13 +38,6 @@ function getWhereFields({ typeName, fields, enableRegex }: { typeName: string; f }, {}), ...[...fields.primitiveFields, ...fields.dateTimeFields, ...fields.enumFields, ...fields.pointFields].reduce( (res, f) => { - // This is the only sensible place to flag whether Point and CartesianPoint are used - // if (f.typeMeta.name === "Point") { - // pointInTypeDefs = true; - // } else if (f.typeMeta.name === "CartesianPoint") { - // cartesianPointInTypeDefs = true; - // } - res[f.fieldName] = f.typeMeta.input.where.pretty; res[`${f.fieldName}_NOT`] = f.typeMeta.input.where.pretty; diff --git a/packages/graphql/src/schema/make-augmented-schema.ts b/packages/graphql/src/schema/make-augmented-schema.ts index 113aba1a4a..028e395287 100644 --- a/packages/graphql/src/schema/make-augmented-schema.ts +++ b/packages/graphql/src/schema/make-augmented-schema.ts @@ -310,7 +310,7 @@ function makeAugmentedSchema( composer.createInputTC({ name: `${relationship.name.value}CreateInput`, - // TODO - Duplicated with rel properties + // TODO - Duplicated with node properties on line 492 fields: relationshipFieldMeta.reduce((res, f) => { if ((f as PrimitiveField)?.autogenerate) { return res; @@ -489,7 +489,7 @@ function makeAugmentedSchema( const nodeInput = composer.createInputTC({ name: `${node.name}CreateInput`, - // TODO - Duplicated with rel properties + // TODO - Duplicated with relationship properties on line 313 fields: [ ...node.primitiveFields, ...node.scalarFields, @@ -573,24 +573,6 @@ function makeAugmentedSchema( }, }); - // composer.createInputTC({ - // name: `${node.name}DisconnectFieldInput`, - // fields: { - // where: `${node.name}Where`, - // ...(node.relationFields.length ? { disconnect: nodeDisconnectInput } : {}), - // }, - // }); - - // if (!composer.has(`${node.name}DeleteFieldInput`)) { - // composer.createInputTC({ - // name: `${node.name}DeleteFieldInput`, - // fields: { - // where: `${node.name}Where`, - // ...(node.relationFields.length ? { delete: nodeDeleteInput } : {}), - // }, - // }); - // } - node.relationFields.forEach((rel) => { if (rel.union) { const refNodes = nodes.filter((x) => rel.union?.nodes?.includes(x.name)); @@ -614,13 +596,6 @@ function makeAugmentedSchema( const nodeFieldDeleteInputName = `${unionPrefix}DeleteFieldInput`; const nodeFieldDisconnectInputName = `${unionPrefix}DisconnectFieldInput`; - // const disconnectField = rel.typeMeta.array - // ? `[${n.name}DisconnectFieldInput!]` - // : `${n.name}DisconnectFieldInput`; - // const deleteField = rel.typeMeta.array - // ? `[${n.name}DeleteFieldInput!]` - // : `${n.name}DeleteFieldInput`; - composeNode.addFieldArgs(rel.fieldName, { [n.name]: `${n.name}Where`, }); @@ -760,9 +735,6 @@ function makeAugmentedSchema( const nodeFieldUpdateInputName = `${node.name}${upperFirstLetter(rel.fieldName)}UpdateFieldInput`; const nodeFieldDeleteInputName = `${node.name}${upperFirstLetter(rel.fieldName)}DeleteFieldInput`; const nodeFieldDisconnectInputName = `${node.name}${upperFirstLetter(rel.fieldName)}DisconnectFieldInput`; - // const disconnectField = rel.typeMeta.array - // ? `[${n.name}DisconnectFieldInput!]` - // : `${n.name}DisconnectFieldInput`; whereInput.addFields({ ...{ [rel.fieldName]: `${n.name}Where`, [`${rel.fieldName}_NOT`]: `${n.name}Where` }, diff --git a/packages/graphql/src/translate/connection/create-connection-and-params.ts b/packages/graphql/src/translate/connection/create-connection-and-params.ts index 619750426d..cf446c36ef 100644 --- a/packages/graphql/src/translate/connection/create-connection-and-params.ts +++ b/packages/graphql/src/translate/connection/create-connection-and-params.ts @@ -25,54 +25,6 @@ import Relationship from "../../classes/Relationship"; import createRelationshipPropertyElement from "../projection/elements/create-relationship-property-element"; import createConnectionWhereAndParams from "../where/create-connection-where-and-params"; -/* -input: - -{ - actorsConnection: { - alias: "actorsConnection" - name: "actorsConnection" - args: { where, options }???? - fieldsByTypeName: { - MovieActorsConnection: { - edges: { - alias: "edges" - name: "edges" - args: { } - fieldsByTypeName: { - MovieActorsRelationship: { - screenTime: { - alias: "screenTime" - name: "screenTime" - } - node: { - alias: "node" - name: "node" - fieldsByTypeName: { PASS ME BACK TO create-projection-and-params - .......... - } - } - } - } - } - } - } - } -} - -output: - -actorsConnection: apoc.cypher.runFirstColumn( - " - MATCH (this)<-[this_acted_in:ACTED_IN]-(this_actors:Actor) - WITH collect({ screenTime: this_acted_in.screenTime, node: { name: this_actors.name }}) as edges - RETURN { edges: edges } - ", - {this: this}, - true - ) - -*/ function createConnectionAndParams({ resolveTree, field, @@ -231,11 +183,6 @@ function createConnectionAndParams({ const nodeOutStr = `(${relatedNodeVariable}:${field.relationship.typeMeta.name})`; const relatedNode = context.neoSchema.nodes.find((x) => x.name === field.relationship.typeMeta.name) as Node; - /* - MATCH clause, example: - - MATCH (this)<-[this_acted_in:ACTED_IN]-(this_actor:Actor) - */ subquery.push(`MATCH (${nodeVariable})${inStr}${relTypeStr}${outStr}${nodeOutStr}`); if (whereInput) { diff --git a/packages/graphql/src/translate/create-delete-and-params.ts b/packages/graphql/src/translate/create-delete-and-params.ts index 860aa60c95..1e5f817d67 100644 --- a/packages/graphql/src/translate/create-delete-and-params.ts +++ b/packages/graphql/src/translate/create-delete-and-params.ts @@ -96,13 +96,11 @@ function createDeleteAndParams({ relationshipVariable, relationship, parameterPrefix: `${parameterPrefix}${!recursing ? `.${key}` : ""}${ - // used here relationField.typeMeta.array ? `[${index}]` : "" }.where`, }); if (whereAndParams[0]) { whereStrs.push(whereAndParams[0]); - // res.params = { ...res.params, ...whereAndParams[1] }; } } const whereAuth = createAuthAndParams({ @@ -145,7 +143,7 @@ function createDeleteAndParams({ parentVar: _varName, parameterPrefix: `${parameterPrefix}${!recursing ? `.${key}` : ""}${ relationField.typeMeta.array ? `[${index}]` : "" - }.delete`, // TODO + }.delete`, recursing: false, }); res.strs.push(deleteAndParams[0]); diff --git a/packages/graphql/src/translate/translate-update.ts b/packages/graphql/src/translate/translate-update.ts index 8f24a4ae6b..48f3a3c0b2 100644 --- a/packages/graphql/src/translate/translate-update.ts +++ b/packages/graphql/src/translate/translate-update.ts @@ -102,8 +102,6 @@ function translateUpdate({ node, context }: { node: Node; context: Context }): [ [updateStr] = updateAndParams; cypherParams = { ...cypherParams, - // Crude check if parameter is actually used before adding it - // ...(updateStr.includes(resolveTree.name) ? { [resolveTree.name]: { args: { update: updateInput } } } : {}), ...updateAndParams[1], }; updateArgs = { @@ -234,7 +232,6 @@ function translateUpdate({ node, context }: { node: Node; context: Context }): [ [deleteStr] = deleteAndParams; cypherParams = { ...cypherParams, - // ...(deleteStr.includes(resolveTree.name) ? { [resolveTree.name]: { args: { delete: deleteInput } } } : {}), ...deleteAndParams[1], }; updateArgs = { diff --git a/packages/graphql/src/translate/where/create-connection-where-and-params.ts b/packages/graphql/src/translate/where/create-connection-where-and-params.ts index 35e7f2f5b2..033f0339d7 100644 --- a/packages/graphql/src/translate/where/create-connection-where-and-params.ts +++ b/packages/graphql/src/translate/where/create-connection-where-and-params.ts @@ -60,9 +60,6 @@ function createConnectionWhereAndParams({ innerParams.push(or[1]); }); - // whereStrs.push(`(${innerClauses.join(` ${k} `)})`); - // params = { ...params, [k]: innerParams }; - const whereStrs = [...res.whereStrs, `(${innerClauses.filter((clause) => !!clause).join(` ${k} `)})`]; const params = { ...res.params, [k]: innerParams }; res = { whereStrs, params }; @@ -77,8 +74,6 @@ function createConnectionWhereAndParams({ context, parameterPrefix: `${parameterPrefix}.${k}`, }); - // whereStrs.push(k === "relationship_NOT" ? `(NOT ${relationshipWhere[0]})` : relationshipWhere[0]); - // params = { ...params, [k]: relationshipWhere[1] }; const whereStrs = [ ...res.whereStrs, @@ -97,8 +92,6 @@ function createConnectionWhereAndParams({ context, parameterPrefix: `${parameterPrefix}.${k}`, }); - // whereStrs.push(k.endsWith("_NOT") ? `(NOT ${nodeWhere[0]})` : nodeWhere[0]); - // params = { ...params, [k]: nodeWhere[1] }; const whereStrs = [...res.whereStrs, k.endsWith("_NOT") ? `(NOT ${nodeWhere[0]})` : nodeWhere[0]]; const params = { ...res.params, [k]: nodeWhere[1] }; diff --git a/packages/graphql/src/translate/where/create-node-where-and-params.ts b/packages/graphql/src/translate/where/create-node-where-and-params.ts index 65b8665c3e..76a916d20c 100644 --- a/packages/graphql/src/translate/where/create-node-where-and-params.ts +++ b/packages/graphql/src/translate/where/create-node-where-and-params.ts @@ -87,14 +87,11 @@ function createNodeWhereAndParams({ whereInput: v, node, nodeVariable, - // chainStr: `${param}${i > 0 ? i : ""}`, context, - // recursing: true, parameterPrefix: `${parameterPrefix}.${fieldName}[${i}]`, }); innerClauses.push(`(${recurse[0]})`); - // res.params = { ...res.params, ...recurse[1] }; nestedParams.push(recurse[1]); }); @@ -211,14 +208,7 @@ function createNodeWhereAndParams({ resultStr += ")"; // close ALL res.clauses.push(resultStr); res.params = { ...res.params, fieldName: nestedParams }; - // } else if (pointField) { - // let clause = `${property} IN [p in $${param} | point(p)]`; - // if (not) clause = `(NOT ${clause})`; - // res.clauses.push(clause); - // res.params[key] = value; } else { - // let clause = `${property} IN $${param}`; - // if (not) clause = `(NOT ${clause})`; const clause = createFilter({ left: property, operator, @@ -280,7 +270,6 @@ function createNodeWhereAndParams({ } const { clauses, params } = Object.entries(whereInput).reduce(reducer, { clauses: [], params: {} }); - // let where = `${!recursing ? "WHERE " : ""}`; const where = clauses.join(" AND ").replace(/INNER_WHERE/gi, "WHERE"); return [where, params]; diff --git a/packages/graphql/src/translate/where/create-relationship-where-and-params.ts b/packages/graphql/src/translate/where/create-relationship-where-and-params.ts index cf0e811a08..b82303b587 100644 --- a/packages/graphql/src/translate/where/create-relationship-where-and-params.ts +++ b/packages/graphql/src/translate/where/create-relationship-where-and-params.ts @@ -171,7 +171,6 @@ function createRelationshipWhereAndParams({ } const { clauses, params } = Object.entries(whereInput).reduce(reducer, { clauses: [], params: {} }); - // let where = `${!recursing ? "WHERE " : ""}`; const where = clauses.join(" AND ").replace(/INNER_WHERE/gi, "WHERE"); return [where, params]; From fb03f39b34d2b5cbe3f1bd4fd4b0bc97daaa2717 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Tue, 15 Jun 2021 13:52:28 +0100 Subject: [PATCH 4/4] Update code comment --- packages/graphql/src/schema/make-augmented-schema.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graphql/src/schema/make-augmented-schema.ts b/packages/graphql/src/schema/make-augmented-schema.ts index 028e395287..eb46694c54 100644 --- a/packages/graphql/src/schema/make-augmented-schema.ts +++ b/packages/graphql/src/schema/make-augmented-schema.ts @@ -310,7 +310,7 @@ function makeAugmentedSchema( composer.createInputTC({ name: `${relationship.name.value}CreateInput`, - // TODO - Duplicated with node properties on line 492 + // TODO - This reduce duplicated when creating node CreateInput - put into shared function? fields: relationshipFieldMeta.reduce((res, f) => { if ((f as PrimitiveField)?.autogenerate) { return res; @@ -489,7 +489,7 @@ function makeAugmentedSchema( const nodeInput = composer.createInputTC({ name: `${node.name}CreateInput`, - // TODO - Duplicated with relationship properties on line 313 + // TODO - This reduce duplicated when creating relationship CreateInput - put into shared function? fields: [ ...node.primitiveFields, ...node.scalarFields,