From c8e1afe5537ff09b4ad11e100765f583d23eb692 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Tue, 15 Jun 2021 12:57:07 +0100 Subject: [PATCH 1/8] 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/8] 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/8] 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/8] 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, From 25689029f9ef6be7a57e9f78af1384643723c270 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Wed, 16 Jun 2021 11:05:49 +0100 Subject: [PATCH 5/8] Fix TCK tests broken from merge --- .../tests/tck/tck-test-files/schema/connections/enums.md | 4 ++-- .../tests/tck/tck-test-files/schema/connections/unions.md | 6 +++--- .../tck/tck-test-files/schema/relationship-properties.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md b/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md index 9a84ad55aa..cb314595be 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md @@ -361,8 +361,8 @@ type Mutation { } type Query { - actors(where: ActorWhere, options: ActorOptions): [Actor]! - movies(where: MovieWhere, options: MovieOptions): [Movie]! + actors(where: ActorWhere, options: ActorOptions): [Actor!]! + movies(where: MovieWhere, options: MovieOptions): [Movie!]! } enum SortDirection { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md b/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md index 4c96799666..0fdd6b9884 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md @@ -495,9 +495,9 @@ type Mutation { union Publication = Book | Journal type Query { - authors(where: AuthorWhere, options: AuthorOptions): [Author]! - books(where: BookWhere, options: BookOptions): [Book]! - journals(where: JournalWhere, options: JournalOptions): [Journal]! + authors(where: AuthorWhere, options: AuthorOptions): [Author!]! + books(where: BookWhere, options: BookOptions): [Book!]! + journals(where: JournalWhere, options: JournalOptions): [Journal!]! } input QueryOptions { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md b/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md index cad6f82ca3..148b7fe848 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md @@ -335,8 +335,8 @@ type Mutation { } type Query { - actors(where: ActorWhere, options: ActorOptions): [Actor]! - movies(where: MovieWhere, options: MovieOptions): [Movie]! + actors(where: ActorWhere, options: ActorOptions): [Actor!]! + movies(where: MovieWhere, options: MovieOptions): [Movie!]! } enum SortDirection { From b479c856b23b32d9f9d71f1a99162226a90ce2ff Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Fri, 18 Jun 2021 11:03:13 +0100 Subject: [PATCH 6/8] Add scalars earlier in schema augmentation for use in types and interfaces without throwing Error (fixes DateTime relationship properties) --- 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 29462e6917..d0912f72a5 100644 --- a/packages/graphql/src/schema/make-augmented-schema.ts +++ b/packages/graphql/src/schema/make-augmented-schema.ts @@ -155,6 +155,8 @@ function makeAugmentedSchema( composer.addTypeDefs(print({ kind: "Document", definitions: extraDefinitions })); } + Object.keys(Scalars).forEach((scalar) => composer.addTypeDefs(`scalar ${scalar}`)); + const nodes = objectNodes.map((definition) => { if (definition.name.value === "PageInfo") { throw new Error( @@ -1054,8 +1056,6 @@ function makeAugmentedSchema( }); }); - Object.keys(Scalars).forEach((scalar) => composer.addTypeDefs(`scalar ${scalar}`)); - if (!Object.values(composer.Mutation.getFields()).length) { composer.delete("Mutation"); } From ebc95e86c36bea5cba89d1903f48c1a2a8931075 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Fri, 18 Jun 2021 11:46:07 +0100 Subject: [PATCH 7/8] Changes to accomodate merge from master --- .../src/schema/make-augmented-schema.ts | 24 +++++++++++++++---- .../connect.int.test.ts | 12 +++++----- .../create.int.test.ts | 16 ++++++------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/packages/graphql/src/schema/make-augmented-schema.ts b/packages/graphql/src/schema/make-augmented-schema.ts index 8bbcc31516..974ea92abf 100644 --- a/packages/graphql/src/schema/make-augmented-schema.ts +++ b/packages/graphql/src/schema/make-augmented-schema.ts @@ -39,8 +39,10 @@ import { InputTypeComposer, ObjectTypeComposer, InputTypeComposerFieldConfigAsObjectDefinition, + ObjectTypeComposerFieldConfigAsObjectDefinition, } from "graphql-compose"; import pluralize from "pluralize"; +import { Integer, isInt } from "neo4j-driver"; import { Node, Exclude } from "../classes"; import getAuth from "./get-auth"; import { PrimitiveField, Auth, CustomEnumField } from "../types"; @@ -257,12 +259,25 @@ function makeAugmentedSchema( ...relationship.fields?.reduce((res, f) => { const typeMeta = getFieldTypeMeta(f); + const newField = { + description: f.description?.value, + type: typeMeta.pretty, + } as ObjectTypeComposerFieldConfigAsObjectDefinition; + + if (["Int", "Float"].includes(typeMeta.name)) { + newField.resolve = (source) => { + // @ts-ignore: outputValue is unknown, and to cast to object would be an antipattern + if (isInt(source[f.name.value])) { + return (source[f.name.value] as Integer).toNumber(); + } + + return source[f.name.value]; + }; + } + return { ...res, - [f.name.value]: { - description: f.description?.value, - type: typeMeta.pretty, - }, + [f.name.value]: newField, }; }, {}), }, @@ -1080,7 +1095,6 @@ function makeAugmentedSchema( } unions.forEach((union) => { - // eslint-disable-next-line no-underscore-dangle if (!generatedResolvers[union.name.value]) { generatedResolvers[union.name.value] = { __resolveType: (root) => root.__resolveType }; } diff --git a/packages/graphql/tests/integration/relationship-properties/connect.int.test.ts b/packages/graphql/tests/integration/relationship-properties/connect.int.test.ts index 266b890108..359e75910d 100644 --- a/packages/graphql/tests/integration/relationship-properties/connect.int.test.ts +++ b/packages/graphql/tests/integration/relationship-properties/connect.int.test.ts @@ -59,7 +59,7 @@ describe("Relationship properties - connect", () => { const session = driver.session(); const movieTitle = generate({ charset: "alphabetic" }); const actorName = generate({ charset: "alphabetic" }); - const screenTime = Math.floor((Math.random() * 1e10) / Math.random()); + const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); const source = ` mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { @@ -68,9 +68,9 @@ describe("Relationship properties - connect", () => { { title: $movieTitle actors: { - connect: [{ + connect: [{ where: { name: $actorName }, - properties: { screenTime: $screenTime }, + properties: { screenTime: $screenTime }, }] } } @@ -157,7 +157,7 @@ describe("Relationship properties - connect", () => { const session = driver.session(); const movieTitle = generate({ charset: "alphabetic" }); const actorName = generate({ charset: "alphabetic" }); - const screenTime = Math.floor((Math.random() * 1e10) / Math.random()); + const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); const source = ` mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { @@ -240,7 +240,7 @@ describe("Relationship properties - connect", () => { const session = driver.session(); const movieTitle = generate({ charset: "alphabetic" }); const actorName = generate({ charset: "alphabetic" }); - const screenTime = Math.floor((Math.random() * 1e10) / Math.random()); + const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); const source = ` mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { @@ -335,7 +335,7 @@ describe("Relationship properties - connect", () => { const session = driver.session(); const movieTitle = generate({ charset: "alphabetic" }); const actorName = generate({ charset: "alphabetic" }); - const screenTime = Math.floor((Math.random() * 1e10) / Math.random()); + const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); const source = ` mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { diff --git a/packages/graphql/tests/integration/relationship-properties/create.int.test.ts b/packages/graphql/tests/integration/relationship-properties/create.int.test.ts index 8a346ffd23..a289766da1 100644 --- a/packages/graphql/tests/integration/relationship-properties/create.int.test.ts +++ b/packages/graphql/tests/integration/relationship-properties/create.int.test.ts @@ -59,7 +59,7 @@ describe("Relationship properties - create", () => { const session = driver.session(); const movieTitle = generate({ charset: "alphabetic" }); const actorName = generate({ charset: "alphabetic" }); - const screenTime = Math.floor((Math.random() * 1e10) / Math.random()); + const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); const source = ` mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { @@ -68,9 +68,9 @@ describe("Relationship properties - create", () => { { title: $movieTitle actors: { - create: [{ - properties: { screenTime: $screenTime }, - node: { name: $actorName } + create: [{ + properties: { screenTime: $screenTime }, + node: { name: $actorName } }] } } @@ -145,7 +145,7 @@ describe("Relationship properties - create", () => { const session = driver.session(); const movieTitle = generate({ charset: "alphabetic" }); const actorName = generate({ charset: "alphabetic" }); - const words = Math.floor((Math.random() * 1e10) / Math.random()); + const words = Math.floor((Math.random() * 1e3) / Math.random()); const source = ` mutation($actorName: String!, $words: Int!, $movieTitle: String!) { @@ -154,9 +154,9 @@ describe("Relationship properties - create", () => { { name: $actorName publications_Movie: { - create: [{ - properties: { words: $words }, - node: { title: $movieTitle } + create: [{ + properties: { words: $words }, + node: { title: $movieTitle } }] } } From a4dd33865c9336851e5dec0f2c2e46e851cc71a3 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Mon, 5 Jul 2021 11:05:41 +0100 Subject: [PATCH 8/8] Rename skip to offset --- .../guides/migration-guide/queries.adoc | 4 +- docs/asciidoc/ogm/getting-started.adoc | 4 +- docs/asciidoc/schema/pagination.adoc | 10 ++--- docs/asciidoc/schema/sorting.adoc | 2 +- examples/neo-push/README.md | 6 +-- .../neo-push/client/src/components/Blog.tsx | 12 ++--- .../client/src/components/Dashboard.tsx | 24 +++++----- .../neo-push/client/src/components/Post.tsx | 12 ++--- examples/neo-push/client/src/queries.ts | 24 +++++----- .../src/schema/make-augmented-schema.ts | 6 +-- .../graphql/src/schema/pagination.test.ts | 44 +++++++++---------- packages/graphql/src/schema/pagination.ts | 28 +++++++----- .../create-connection-and-params.test.ts | 2 +- .../create-connection-and-params.ts | 14 +++--- .../translate/create-projection-and-params.ts | 19 +++++--- .../graphql/src/translate/translate-read.ts | 12 ++--- packages/graphql/src/types.ts | 2 +- .../tck/tck-test-files/cypher/pagination.md | 37 +++++++++------- .../tests/tck/tck-test-files/cypher/sort.md | 12 ++--- .../tests/tck/tck-test-files/cypher/union.md | 2 +- .../tests/tck/tck-test-files/schema/arrays.md | 2 +- .../tck/tck-test-files/schema/comments.md | 2 +- .../schema/connections/enums.md | 4 +- .../schema/connections/unions.md | 8 ++-- .../tck-test-files/schema/custom-mutations.md | 2 +- .../schema/directive-preserve.md | 2 +- .../schema/directives/access-directives.md | 2 +- .../schema/directives/autogenerate.md | 2 +- .../schema/directives/cypher.md | 4 +- .../schema/directives/default.md | 2 +- .../schema/directives/exclude.md | 14 +++--- .../schema/directives/ignore.md | 2 +- .../schema/directives/private.md | 2 +- .../schema/directives/timestamps.md | 2 +- .../tests/tck/tck-test-files/schema/enum.md | 2 +- .../tests/tck/tck-test-files/schema/extend.md | 2 +- .../tests/tck/tck-test-files/schema/inputs.md | 2 +- .../tck/tck-test-files/schema/interfaces.md | 2 +- .../tck/tck-test-files/schema/issues/#162.md | 6 +-- .../tck/tck-test-files/schema/issues/#200.md | 2 +- .../tests/tck/tck-test-files/schema/null.md | 2 +- .../schema/relationship-properties.md | 4 +- .../tck/tck-test-files/schema/relationship.md | 8 ++-- .../tests/tck/tck-test-files/schema/scalar.md | 2 +- .../tests/tck/tck-test-files/schema/simple.md | 2 +- .../tck/tck-test-files/schema/types/bigint.md | 2 +- .../tck/tck-test-files/schema/types/date.md | 2 +- .../tck-test-files/schema/types/datetime.md | 2 +- .../tck/tck-test-files/schema/types/points.md | 8 ++-- .../tests/tck/tck-test-files/schema/unions.md | 6 +-- 50 files changed, 197 insertions(+), 183 deletions(-) diff --git a/docs/asciidoc/guides/migration-guide/queries.adoc b/docs/asciidoc/guides/migration-guide/queries.adoc index f06ce06274..a5537cfde9 100644 --- a/docs/asciidoc/guides/migration-guide/queries.adoc +++ b/docs/asciidoc/guides/migration-guide/queries.adoc @@ -34,7 +34,7 @@ Changes to note for migration: * Query fields were previously named in the singular, and in _PascalCase_ - they are now pluralized and in _camelCase_ * Query return types were previously in nullable lists of nullable types - they are now non-nullable lists of non-nullable types, _e.g._ `[Movie]` is now `[Movie!]!`; ensuring either an array of defined `Movie` objects or an empty array. * In this example, the `_MovieFilter` type has essentially been renamed to `MovieWhere`, the `filter` arguments renamed to `where`, and the top-level field arguments `title` and `averageRating` removed - see <> below -* The `first`, `offset` and `orderBy` have been collapsed into the `MovieOptions` type and renamed `limit`, `skip` and `sort`, respectively - see <> below +* The `first`, `offset` and `orderBy` have been collapsed into the `MovieOptions` type and renamed `limit`, `offset` and `sort`, respectively - see <> below [[migration-guide-queries-filtering]] == Filtering (`where`) @@ -206,7 +206,7 @@ Using `@neo4j/graphql`, this will now be: [source, graphql] ---- query { - movies(options: { skip: 20, limit: 10 }) { + movies(options: { offset: 20, limit: 10 }) { title } } diff --git a/docs/asciidoc/ogm/getting-started.adoc b/docs/asciidoc/ogm/getting-started.adoc index dc651fc845..8603065a6c 100644 --- a/docs/asciidoc/ogm/getting-started.adoc +++ b/docs/asciidoc/ogm/getting-started.adoc @@ -47,14 +47,14 @@ const User = ogm.model("User"); const app = express(); app.get("/users", async (req, res) => { - const { search, skip, limit, sort } = req.query; + const { search, offset, limit, sort } = req.query; const regex = search ? `(?i).*${search}.*` : null; const users = await User.find({ where: { name_REGEX: regex }, options: { - skip, + offset, limit, sort } diff --git a/docs/asciidoc/schema/pagination.adoc b/docs/asciidoc/schema/pagination.adoc index 2e3fcc8e6a..f3954b1d62 100644 --- a/docs/asciidoc/schema/pagination.adoc +++ b/docs/asciidoc/schema/pagination.adoc @@ -3,7 +3,7 @@ == Page-based pagination -Page-based pagination can be achieved through the use of the `skip` and `limit` options available whilst querying for data. +Page-based pagination can be achieved through the use of the `offset` and `limit` options available whilst querying for data. Using the following type definition: @@ -27,14 +27,14 @@ query { } ---- -And then on subsequent calls, introduce the `skip` argument and increment it by 10 on each call. +And then on subsequent calls, introduce the `offset` argument and increment it by 10 on each call. Page 2: [source, graphql] ---- query { users(options: { - skip: 10 + offset: 10 limit: 10 }) { name @@ -47,7 +47,7 @@ Page 3: ---- query { users(options: { - skip: 20 + offset: 20 limit: 10 }) { name @@ -67,7 +67,7 @@ query { }) { name posts(options: { - skip: 20 + offset: 20 limit: 10 }) { content diff --git a/docs/asciidoc/schema/sorting.adoc b/docs/asciidoc/schema/sorting.adoc index 5c5deaf3d0..2e7147f561 100644 --- a/docs/asciidoc/schema/sorting.adoc +++ b/docs/asciidoc/schema/sorting.adoc @@ -36,7 +36,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } type Query { diff --git a/examples/neo-push/README.md b/examples/neo-push/README.md index 43388e1332..584f2cc0a1 100644 --- a/examples/neo-push/README.md +++ b/examples/neo-push/README.md @@ -142,10 +142,10 @@ Once logged in users are directed to the dashboard page; ![dashboard](assets/dashboard.jpg) ```graphql -query myBlogs($id: ID, $skip: Int, $limit: Int, $hasNextBlogsSkip: Int) { +query myBlogs($id: ID, $offset: Int, $limit: Int, $hasNextBlogsoffset: Int) { myBlogs: blogs( where: { OR: [{ creator: { id: $id } }, { authors: { id: $id } }] } - options: { limit: $limit, skip: $skip, sort: { createdAt: DESC } } + options: { limit: $limit, offset: $offset, sort: { createdAt: DESC } } ) { id name @@ -159,7 +159,7 @@ query myBlogs($id: ID, $skip: Int, $limit: Int, $hasNextBlogsSkip: Int) { where: { OR: [{ creator: { id: $id } }, { authors: { id: $id } }] } options: { limit: 1 - skip: $hasNextBlogsSkip + offset: $hasNextBlogsoffset sort: { createdAt: DESC } } ) { diff --git a/examples/neo-push/client/src/components/Blog.tsx b/examples/neo-push/client/src/components/Blog.tsx index 6726fdde0e..56b72b2004 100644 --- a/examples/neo-push/client/src/components/Blog.tsx +++ b/examples/neo-push/client/src/components/Blog.tsx @@ -138,7 +138,7 @@ function CreatePost({ close, blog }: { close: () => void; blog: BlogInterface }) function BlogPosts({ blog }: { blog: BlogInterface }) { const { query } = useContext(graphql.Context); - const [skip, setSkip] = useState(0); + const [offset, setOffset] = useState(0); const [limit] = useState(10); const [hasMore, setHasMore] = useState(false); const [posts, setPosts] = useState([]); @@ -150,9 +150,9 @@ function BlogPosts({ blog }: { blog: BlogInterface }) { query: BLOG_POSTS, variables: { blog: blog.id, - skip: posts.length, + offset: posts.length, limit, - hasNextPostsSkip: posts.length === 0 ? limit : posts.length + 1, + hasNextPostsOffset: posts.length === 0 ? limit : posts.length + 1, }, }); @@ -161,11 +161,11 @@ function BlogPosts({ blog }: { blog: BlogInterface }) { } catch (e) {} setLoading(false); - }, [skip, posts]); + }, [offset, posts]); useEffect(() => { getPosts(); - }, [skip]); + }, [offset]); if (loading) { @@ -190,7 +190,7 @@ function BlogPosts({ blog }: { blog: BlogInterface }) { {hasMore && (

- +
)} diff --git a/examples/neo-push/client/src/components/Dashboard.tsx b/examples/neo-push/client/src/components/Dashboard.tsx index c9d3198da6..57c5ea22ec 100644 --- a/examples/neo-push/client/src/components/Dashboard.tsx +++ b/examples/neo-push/client/src/components/Dashboard.tsx @@ -114,7 +114,7 @@ function BlogItem(props: { blog: any; updated?: boolean }) { function MyBlogs() { const { getId } = useContext(auth.Context); const { query } = useContext(graphql.Context); - const [skip, setSkip] = useState(0); + const [offset, setOffset] = useState(0); const [limit] = useState(10); const [myBlogsHasMore, setMyBlogsHasMore] = useState(false); const [blogs, setBlogs] = useState([]); @@ -128,9 +128,9 @@ function MyBlogs() { query: MY_BLOGS, variables: { id: getId(), - skip: blogs.length, + offset: blogs.length, limit, - hasNextBlogsSkip: blogs.length === 0 ? limit : blogs.length + 1, + hasNextBlogsOffset: blogs.length === 0 ? limit : blogs.length + 1, }, }); @@ -139,11 +139,11 @@ function MyBlogs() { } catch (e) {} setLoading(false); - }, [skip, blogs, limit]); + }, [offset, blogs, limit]); useEffect(() => { getBlogs(); - }, [skip]); + }, [offset]); if (loading) { @@ -163,7 +163,7 @@ function MyBlogs() { ))} {myBlogsHasMore && ( -
setSkip((s) => s + 1)}> +
setOffset((s) => s + 1)}>
)} @@ -174,7 +174,7 @@ function MyBlogs() { function RecentlyUpdatedBlogs() { const { query } = useContext(graphql.Context); const [limit] = useState(10); - const [skip, setSkip] = useState(0); + const [offset, setOffset] = useState(0); const [myBlogsHasMore, setMyBlogsHasMore] = useState(false); const [blogs, setBlogs] = useState([]); const [loading, setLoading] = useState(true); @@ -185,9 +185,9 @@ function RecentlyUpdatedBlogs() { const response = await query({ query: RECENTLY_UPDATED_BLOGS, variables: { - skip: blogs.length, + offset: blogs.length, limit, - hasNextBlogsSkip: blogs.length === 0 ? limit : blogs.length + 1, + hasNextBlogsOffset: blogs.length === 0 ? limit : blogs.length + 1, }, }); @@ -196,11 +196,11 @@ function RecentlyUpdatedBlogs() { } catch (e) {} setLoading(false); - }, [skip, blogs]); + }, [offset, blogs]); useEffect(() => { getBlogs(); - }, [skip]); + }, [offset]); if (loading) { @@ -220,7 +220,7 @@ function RecentlyUpdatedBlogs() { ))} {myBlogsHasMore && ( -
setSkip((s) => s + 1)}> +
setOffset((s) => s + 1)}>
)} diff --git a/examples/neo-push/client/src/components/Post.tsx b/examples/neo-push/client/src/components/Post.tsx index f31f23c99e..6f8dc4e938 100644 --- a/examples/neo-push/client/src/components/Post.tsx +++ b/examples/neo-push/client/src/components/Post.tsx @@ -396,7 +396,7 @@ function PostComments({ setComments: (cb: (comments: Comment[]) => any) => void; }) { const { query } = useContext(graphql.Context); - const [skip, setSkip] = useState(0); + const [offset, setOffset] = useState(0); const [limit] = useState(10); const [hasMore, setHasMore] = useState(false); const [loading, setLoading] = useState(true); @@ -408,9 +408,9 @@ function PostComments({ query: POST_COMMENTS, variables: { post, - skip: comments.length, + offset: comments.length, limit, - hasNextCommentsSkip: comments.length === 0 ? limit : comments.length + 1, + hasNextCommentsOffset: comments.length === 0 ? limit : comments.length + 1, }, }); @@ -423,11 +423,11 @@ function PostComments({ } setLoading(false); - }, [skip]); + }, [offset]); useEffect(() => { getComments(); - }, [skip]); + }, [offset]); if (error) { return ( @@ -463,7 +463,7 @@ function PostComments({ ))} {hasMore && (
- +
)} diff --git a/examples/neo-push/client/src/queries.ts b/examples/neo-push/client/src/queries.ts index b742647741..a01a0295d9 100644 --- a/examples/neo-push/client/src/queries.ts +++ b/examples/neo-push/client/src/queries.ts @@ -33,10 +33,10 @@ export const CREATE_BLOG = gql` `; export const MY_BLOGS = gql` - query myBlogs($id: ID, $skip: Int, $limit: Int, $hasNextBlogsSkip: Int) { + query myBlogs($id: ID, $offset: Int, $limit: Int, $hasNextBlogsOffset: Int) { myBlogs: blogs( where: { OR: [{ creator: { id: $id } }, { authors: { id: $id } }] } - options: { limit: $limit, skip: $skip, sort: { createdAt: DESC } } + options: { limit: $limit, offset: $offset, sort: { createdAt: DESC } } ) { id name @@ -48,7 +48,7 @@ export const MY_BLOGS = gql` } hasNextBlogs: blogs( where: { OR: [{ creator: { id: $id } }, { authors: { id: $id } }] } - options: { limit: 1, skip: $hasNextBlogsSkip, sort: { createdAt: DESC } } + options: { limit: 1, offset: $hasNextBlogsOffset, sort: { createdAt: DESC } } ) { id } @@ -56,8 +56,8 @@ export const MY_BLOGS = gql` `; export const RECENTLY_UPDATED_BLOGS = gql` - query recentlyUpdatedBlogs($skip: Int, $limit: Int, $hasNextBlogsSkip: Int) { - recentlyUpdatedBlogs: blogs(options: { limit: $limit, skip: $skip, sort: { updatedAt: DESC } }) { + query recentlyUpdatedBlogs($offset: Int, $limit: Int, $hasNextBlogsOffset: Int) { + recentlyUpdatedBlogs: blogs(options: { limit: $limit, offset: $offset, sort: { updatedAt: DESC } }) { id name creator { @@ -66,7 +66,7 @@ export const RECENTLY_UPDATED_BLOGS = gql` } updatedAt } - hasNextBlogs: blogs(options: { limit: 1, skip: $hasNextBlogsSkip, sort: { updatedAt: DESC } }) { + hasNextBlogs: blogs(options: { limit: 1, offset: $hasNextBlogsOffset, sort: { updatedAt: DESC } }) { id } } @@ -155,10 +155,10 @@ export const POST = gql` `; export const BLOG_POSTS = gql` - query blogPosts($blog: ID, $skip: Int, $limit: Int, $hasNextPostsSkip: Int) { + query blogPosts($blog: ID, $offset: Int, $limit: Int, $hasNextPostsOffset: Int) { blogPosts: posts( where: { blog: { id: $blog } } - options: { skip: $skip, limit: $limit, sort: { createdAt: DESC } } + options: { offset: $offset, limit: $limit, sort: { createdAt: DESC } } ) { id title @@ -169,7 +169,7 @@ export const BLOG_POSTS = gql` } hasNextPosts: posts( where: { blog: { id: $blog } } - options: { skip: $hasNextPostsSkip, limit: 1, sort: { createdAt: DESC } } + options: { offset: $hasNextPostsOffset, limit: 1, sort: { createdAt: DESC } } ) { id } @@ -201,10 +201,10 @@ export const COMMENT_ON_POST = gql` `; export const POST_COMMENTS = gql` - query postComments($post: ID, $skip: Int, $limit: Int, $hasNextCommentsSkip: Int) { + query postComments($post: ID, $offset: Int, $limit: Int, $hasNextCommentsOffset: Int) { postComments: comments( where: { post: { id: $post } } - options: { skip: $skip, limit: $limit, sort: { createdAt: ASC } } + options: { offset: $offset, limit: $limit, sort: { createdAt: ASC } } ) { id author { @@ -217,7 +217,7 @@ export const POST_COMMENTS = gql` } hasNextComments: comments( where: { post: { id: $post } } - options: { skip: $hasNextCommentsSkip, limit: 1, sort: { createdAt: ASC } } + options: { offset: $hasNextCommentsOffset, limit: 1, sort: { createdAt: ASC } } ) { id } diff --git a/packages/graphql/src/schema/make-augmented-schema.ts b/packages/graphql/src/schema/make-augmented-schema.ts index b171c532db..164660a5cb 100644 --- a/packages/graphql/src/schema/make-augmented-schema.ts +++ b/packages/graphql/src/schema/make-augmented-schema.ts @@ -97,7 +97,7 @@ function makeAugmentedSchema( const queryOptions = composer.createInputTC({ name: "QueryOptions", fields: { - skip: "Int", + offset: "Int", limit: "Int", }, }); @@ -450,13 +450,13 @@ function makeAugmentedSchema( type: sortInput.List, }, limit: "Int", - skip: "Int", + offset: "Int", }, }); } else { composer.createInputTC({ name: `${node.name}Options`, - fields: { limit: "Int", skip: "Int" }, + fields: { limit: "Int", offset: "Int" }, }); } diff --git a/packages/graphql/src/schema/pagination.test.ts b/packages/graphql/src/schema/pagination.test.ts index 30ebc9cbca..a4485a66c1 100644 --- a/packages/graphql/src/schema/pagination.test.ts +++ b/packages/graphql/src/schema/pagination.test.ts @@ -18,54 +18,54 @@ */ import { offsetToCursor } from "graphql-relay"; import neo4j from "neo4j-driver"; -import { createSkipLimitStr, createConnectionWithEdgeProperties } from "./pagination"; +import { createOffsetLimitStr, createConnectionWithEdgeProperties } from "./pagination"; describe("cursor-pagination", () => { - describe("createSkipLimitStr", () => { - test("it returns an empty string when no skip or limit is provided", () => { + describe("createOffsetLimitStr", () => { + test("it returns an empty string when no offset or limit is provided", () => { const args = {}; - const result = createSkipLimitStr(args); + const result = createOffsetLimitStr(args); expect(result).toBe(""); }); - test("it returns a string with only the sliceStart when skip is provided but limit isn't", () => { - const args = { skip: 10 }; - const result = createSkipLimitStr(args); + test("it returns a string with only the sliceStart when offset is provided but limit isn't", () => { + const args = { offset: 10 }; + const result = createOffsetLimitStr(args); expect(result).toBe("[10..]"); }); - test("it returns a string with only the sliceStart when skip is provided and the limit is zero", () => { - const args = { skip: 10, limit: 0 }; - const result = createSkipLimitStr(args); + test("it returns a string with only the sliceStart when offset is provided and the limit is zero", () => { + const args = { offset: 10, limit: 0 }; + const result = createOffsetLimitStr(args); expect(result).toBe("[10..]"); }); - test("it returns a string with only the sliceEnd when limit is provided but skip isn't", () => { + test("it returns a string with only the sliceEnd when limit is provided but offset isn't", () => { const args = { limit: 10 }; - const result = createSkipLimitStr(args); + const result = createOffsetLimitStr(args); expect(result).toBe("[..10]"); }); - test("it returns a string with only the sliceEnd when limit is provided and the skip provided is zero", () => { - const args = { limit: 10, skip: 0 }; - const result = createSkipLimitStr(args); + test("it returns a string with only the sliceEnd when limit is provided and the offset provided is zero", () => { + const args = { limit: 10, offset: 0 }; + const result = createOffsetLimitStr(args); expect(result).toBe("[..10]"); }); - test("it returns a string with the full range of the slice when both skip and limit are provided", () => { - const args = { limit: 10, skip: 30 }; - const result = createSkipLimitStr(args); + test("it returns a string with the full range of the slice when both offset and limit are provided", () => { + const args = { limit: 10, offset: 30 }; + const result = createOffsetLimitStr(args); expect(result).toBe("[30..40]"); }); test("it returns a string with the full range of the slice when Integers are passed for both ski and limit", () => { - const args = { limit: neo4j.int(10), skip: neo4j.int(30) }; - const result = createSkipLimitStr(args); + const args = { limit: neo4j.int(10), offset: neo4j.int(30) }; + const result = createOffsetLimitStr(args); expect(result).toBe("[30..40]"); - const mixedArgs = { limit: neo4j.int(30), skip: 20 }; - const result2 = createSkipLimitStr(mixedArgs); + const mixedArgs = { limit: neo4j.int(30), offset: 20 }; + const result2 = createOffsetLimitStr(mixedArgs); expect(result2).toBe("[20..50]"); }); }); diff --git a/packages/graphql/src/schema/pagination.ts b/packages/graphql/src/schema/pagination.ts index 635b9ef442..c0a3594c11 100644 --- a/packages/graphql/src/schema/pagination.ts +++ b/packages/graphql/src/schema/pagination.ts @@ -62,25 +62,31 @@ export function createConnectionWithEdgeProperties( }; } -export function createSkipLimitStr({ skip, limit }: { skip?: number | Integer; limit?: number | Integer }): string { - const hasSkip = typeof skip !== "undefined" && skip !== 0; +export function createOffsetLimitStr({ + offset, + limit, +}: { + offset?: number | Integer; + limit?: number | Integer; +}): string { + const hasOffset = typeof offset !== "undefined" && offset !== 0; const hasLimit = typeof limit !== "undefined" && limit !== 0; - let skipLimitStr = ""; + let offsetLimitStr = ""; - if (hasSkip && !hasLimit) { - skipLimitStr = `[${skip}..]`; + if (hasOffset && !hasLimit) { + offsetLimitStr = `[${offset}..]`; } - if (hasLimit && !hasSkip) { - skipLimitStr = `[..${limit}]`; + if (hasLimit && !hasOffset) { + offsetLimitStr = `[..${limit}]`; } - if (hasLimit && hasSkip) { - const sliceStart = isInt(skip as Integer) ? (skip as Integer).toNumber() : skip; + if (hasLimit && hasOffset) { + const sliceStart = isInt(offset as Integer) ? (offset as Integer).toNumber() : offset; const itemsToGrab = isInt(limit as Integer) ? (limit as Integer).toNumber() : limit; const sliceEnd = (sliceStart as number) + (itemsToGrab as number); - skipLimitStr = `[${skip}..${sliceEnd}]`; + offsetLimitStr = `[${offset}..${sliceEnd}]`; } - return skipLimitStr; + return offsetLimitStr; } 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 50e12dbc61..d37f5dafa3 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 @@ -229,7 +229,7 @@ describe("createConnectionAndParams", () => { }`); }); - test("Returns an entry with skip and limit args", () => { + test("Returns an entry with offset and limit args", () => { // @ts-ignore const mockedNeo4jGraphQL = mocked(new Neo4jGraphQL(), true); // @ts-ignore 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 1993407755..8a3e1badfd 100644 --- a/packages/graphql/src/translate/connection/create-connection-and-params.ts +++ b/packages/graphql/src/translate/connection/create-connection-and-params.ts @@ -29,7 +29,7 @@ import createRelationshipPropertyElement from "../projection/elements/create-rel import createConnectionWhereAndParams from "../where/create-connection-where-and-params"; import createAuthAndParams from "../create-auth-and-params"; import { AUTH_FORBIDDEN_ERROR } from "../../constants"; -import { createSkipLimitStr } from "../../schema/pagination"; +import { createOffsetLimitStr } from "../../schema/pagination"; function createConnectionAndParams({ resolveTree, @@ -229,12 +229,12 @@ function createConnectionAndParams({ if (!firstInput && !afterInput) { unionSubqueryCypher.push("WITH collect(edge) as edges, count(edge) as totalCount"); } else { - const skipLimitStr = createSkipLimitStr({ - skip: typeof afterInput === "string" ? cursorToOffset(afterInput) + 1 : undefined, + const offsetLimitStr = createOffsetLimitStr({ + offset: typeof afterInput === "string" ? cursorToOffset(afterInput) + 1 : undefined, limit: firstInput as Integer | number | undefined, }); unionSubqueryCypher.push("WITH collect(edge) AS allEdges"); - unionSubqueryCypher.push(`WITH allEdges, size(allEdges) as totalCount, allEdges${skipLimitStr} AS edges`); + unionSubqueryCypher.push(`WITH allEdges, size(allEdges) as totalCount, allEdges${offsetLimitStr} AS edges`); } subquery.push(unionSubqueryCypher.join("\n")); } else { @@ -377,11 +377,11 @@ function createConnectionAndParams({ }` ); } else { - const skipLimitStr = createSkipLimitStr({ - skip: typeof afterInput === "string" ? cursorToOffset(afterInput) + 1 : undefined, + const offsetLimitStr = createOffsetLimitStr({ + offset: typeof afterInput === "string" ? cursorToOffset(afterInput) + 1 : undefined, limit: firstInput as Integer | number | undefined, }); - subquery.push(`WITH edges, size(edges) AS totalCount, edges${skipLimitStr} AS limitedSelection`); + subquery.push(`WITH edges, size(edges) AS totalCount, edges${offsetLimitStr} AS limitedSelection`); subquery.push(`RETURN { edges: limitedSelection, totalCount: totalCount } AS ${resolveTree.alias}`); } subquery.push("}"); diff --git a/packages/graphql/src/translate/create-projection-and-params.ts b/packages/graphql/src/translate/create-projection-and-params.ts index 1056619e07..9c782b6843 100644 --- a/packages/graphql/src/translate/create-projection-and-params.ts +++ b/packages/graphql/src/translate/create-projection-and-params.ts @@ -27,7 +27,7 @@ import createDatetimeElement from "./projection/elements/create-datetime-element import createPointElement from "./projection/elements/create-point-element"; // eslint-disable-next-line import/no-cycle import createConnectionAndParams from "./connection/create-connection-and-params"; -import { createSkipLimitStr } from "../schema/pagination"; +import { createOffsetLimitStr } from "../schema/pagination"; interface Res { projection: string[]; @@ -316,9 +316,12 @@ function createProjectionAndParams({ unionStrs.push(") ]"); if (optionsInput) { - const skipLimit = createSkipLimitStr({ skip: optionsInput.skip, limit: optionsInput.limit }); - if (skipLimit) { - unionStrs.push(skipLimit); + const offsetLimit = createOffsetLimitStr({ + offset: optionsInput.offset, + limit: optionsInput.limit, + }); + if (offsetLimit) { + unionStrs.push(offsetLimit); } } @@ -358,7 +361,7 @@ function createProjectionAndParams({ let nestedQuery; if (optionsInput) { - const skipLimit = createSkipLimitStr({ skip: optionsInput.skip, limit: optionsInput.limit }); + const offsetLimit = createOffsetLimitStr({ offset: optionsInput.offset, limit: optionsInput.limit }); if (optionsInput.sort) { const sorts = optionsInput.sort.reduce((s: string[], sort: GraphQLSortArg) => { @@ -374,9 +377,11 @@ function createProjectionAndParams({ ]; }, []); - nestedQuery = `${key}: apoc.coll.sortMulti([ ${innerStr} ], [${sorts.join(", ")}])${skipLimit}`; + nestedQuery = `${key}: apoc.coll.sortMulti([ ${innerStr} ], [${sorts.join(", ")}])${offsetLimit}`; } else { - nestedQuery = `${key}: ${!isArray ? "head(" : ""}[ ${innerStr} ]${skipLimit}${!isArray ? ")" : ""}`; + nestedQuery = `${key}: ${!isArray ? "head(" : ""}[ ${innerStr} ]${offsetLimit}${ + !isArray ? ")" : "" + }`; } } else { nestedQuery = `${key}: ${!isArray ? "head(" : ""}[ ${innerStr} ]${!isArray ? ")" : ""}`; diff --git a/packages/graphql/src/translate/translate-read.ts b/packages/graphql/src/translate/translate-read.ts index 7c12883fce..c9fe86fba9 100644 --- a/packages/graphql/src/translate/translate-read.ts +++ b/packages/graphql/src/translate/translate-read.ts @@ -35,7 +35,7 @@ function translateRead({ node, context }: { context: Context; node: Node }): [st const matchStr = `MATCH (${varName}:${node.name})`; let whereStr = ""; let authStr = ""; - let skipStr = ""; + let offsetStr = ""; let limitStr = ""; let sortStr = ""; let projAuth = ""; @@ -118,12 +118,12 @@ function translateRead({ node, context }: { context: Context; node: Node }): [st } if (optionsInput) { - const hasSkip = Boolean(optionsInput.skip) || optionsInput.skip === 0; + const hasOffset = Boolean(optionsInput.offset) || optionsInput.offset === 0; const hasLimit = Boolean(optionsInput.limit) || optionsInput.limit === 0; - if (hasSkip) { - skipStr = `SKIP $${varName}_skip`; - cypherParams[`${varName}_skip`] = optionsInput.skip; + if (hasOffset) { + offsetStr = `SKIP $${varName}_offset`; + cypherParams[`${varName}_offset`] = optionsInput.offset; } if (hasLimit) { @@ -153,7 +153,7 @@ function translateRead({ node, context }: { context: Context; node: Node }): [st ...(projAuth ? [`WITH ${varName}`, projAuth] : []), ...connectionStrs, `RETURN ${varName} ${projStr} as ${varName}`, - skipStr, + offsetStr, limitStr, ]; diff --git a/packages/graphql/src/types.ts b/packages/graphql/src/types.ts index 36b4dd3ff7..54bbd6373d 100644 --- a/packages/graphql/src/types.ts +++ b/packages/graphql/src/types.ts @@ -174,7 +174,7 @@ export interface ConnectionQueryArgs { */ export interface GraphQLOptionsArg { limit?: number | Integer; - skip?: number | Integer; + offset?: number | Integer; sort?: GraphQLSortArg[]; } diff --git a/packages/graphql/tests/tck/tck-test-files/cypher/pagination.md b/packages/graphql/tests/tck/tck-test-files/cypher/pagination.md index dcbdcac736..ce6fa1c15c 100644 --- a/packages/graphql/tests/tck/tck-test-files/cypher/pagination.md +++ b/packages/graphql/tests/tck/tck-test-files/cypher/pagination.md @@ -1,6 +1,6 @@ ## Cypher pagination tests -Tests for queries including reserved arguments `skip` and `limit`. +Tests for queries including reserved arguments `offset` and `limit`. Schema: @@ -19,7 +19,7 @@ type Movie { ```graphql { - movies(options: { skip: 1 }) { + movies(options: { offset: 1 }) { title } } @@ -30,14 +30,14 @@ type Movie { ```cypher MATCH (this:Movie) RETURN this { .title } as this -SKIP $this_skip +SKIP $this_offset ``` **Expected Cypher params** ```cypher-params { - "this_skip": { + "this_offset": { "high": 0, "low": 1 } @@ -85,7 +85,7 @@ LIMIT $this_limit ```graphql { - movies(options: { limit: 1, skip: 2 }) { + movies(options: { limit: 1, offset: 2 }) { title } } @@ -96,7 +96,7 @@ LIMIT $this_limit ```cypher MATCH (this:Movie) RETURN this { .title } as this -SKIP $this_skip +SKIP $this_offset LIMIT $this_limit ``` @@ -108,7 +108,7 @@ LIMIT $this_limit "high": 0, "low": 1 }, - "this_skip": { + "this_offset": { "high": 0, "low": 2 } @@ -122,8 +122,8 @@ LIMIT $this_limit **GraphQL input** ```graphql -query($skip: Int, $limit: Int) { - movies(options: { limit: $limit, skip: $skip }) { +query($offset: Int, $limit: Int) { + movies(options: { limit: $limit, offset: $offset }) { title } } @@ -133,7 +133,7 @@ query($skip: Int, $limit: Int) { ```graphql-params { - "skip": 0, + "offset": 0, "limit": 0 } ``` @@ -143,7 +143,7 @@ query($skip: Int, $limit: Int) { ```cypher MATCH (this:Movie) RETURN this { .title } as this -SKIP $this_skip +SKIP $this_offset LIMIT $this_limit ``` @@ -151,7 +151,7 @@ LIMIT $this_limit ```cypher-params { - "this_skip": { + "this_offset": { "high": 0, "low": 0 }, @@ -169,8 +169,11 @@ LIMIT $this_limit **GraphQL input** ```graphql -query($skip: Int, $limit: Int, $title: String) { - movies(options: { limit: $limit, skip: $skip }, where: { title: $title }) { +query($offset: Int, $limit: Int, $title: String) { + movies( + options: { limit: $limit, offset: $offset } + where: { title: $title } + ) { title } } @@ -181,7 +184,7 @@ query($skip: Int, $limit: Int, $title: String) { ```graphql-params { "limit": 1, - "skip": 2, + "offset": 2, "title": "some title" } ``` @@ -192,7 +195,7 @@ query($skip: Int, $limit: Int, $title: String) { MATCH (this:Movie) WHERE this.title = $this_title RETURN this { .title } as this -SKIP $this_skip +SKIP $this_offset LIMIT $this_limit ``` @@ -204,7 +207,7 @@ LIMIT $this_limit "high": 0, "low": 1 }, - "this_skip": { + "this_offset": { "high": 0, "low": 2 }, diff --git a/packages/graphql/tests/tck/tck-test-files/cypher/sort.md b/packages/graphql/tests/tck/tck-test-files/cypher/sort.md index 95c2f2206a..9389da397f 100644 --- a/packages/graphql/tests/tck/tck-test-files/cypher/sort.md +++ b/packages/graphql/tests/tck/tck-test-files/cypher/sort.md @@ -77,16 +77,16 @@ RETURN this { .title } as this --- -### Sort with skip limit & with other variables +### Sort with offset limit & with other variables **GraphQL input** ```graphql -query($title: String, $skip: Int, $limit: Int) { +query($title: String, $offset: Int, $limit: Int) { movies( options: { sort: [{ id: DESC }, { title: ASC }] - skip: $skip + offset: $offset limit: $limit } where: { title: $title } @@ -101,7 +101,7 @@ query($title: String, $skip: Int, $limit: Int) { ```graphql-params { "limit": 2, - "skip": 1, + "offset": 1, "title": "some title" } ``` @@ -114,7 +114,7 @@ WHERE this.title = $this_title WITH this ORDER BY this.id DESC, this.title ASC RETURN this { .title } as this -SKIP $this_skip +SKIP $this_offset LIMIT $this_limit ``` @@ -126,7 +126,7 @@ LIMIT $this_limit "high": 0, "low": 2 }, - "this_skip": { + "this_offset": { "high": 0, "low": 1 }, diff --git a/packages/graphql/tests/tck/tck-test-files/cypher/union.md b/packages/graphql/tests/tck/tck-test-files/cypher/union.md index f56a857f5d..46f36c2cc8 100644 --- a/packages/graphql/tests/tck/tck-test-files/cypher/union.md +++ b/packages/graphql/tests/tck/tck-test-files/cypher/union.md @@ -35,7 +35,7 @@ type Movie { movies(where: { title: "some title" }) { search( where: { Movie: { title: "The Matrix" }, Genre: { name: "Horror" } } - options: { skip: 1, limit: 10 } + options: { offset: 1, limit: 10 } ) { ... on Movie { title diff --git a/packages/graphql/tests/tck/tck-test-files/schema/arrays.md b/packages/graphql/tests/tck/tck-test-files/schema/arrays.md index 78c456352f..ffa6b65547 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/arrays.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/arrays.md @@ -48,7 +48,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/comments.md b/packages/graphql/tests/tck/tck-test-files/schema/comments.md index 52994dc8d3..f10dcb5a98 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/comments.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/comments.md @@ -97,7 +97,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md b/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md index f606fe0795..a8865b96dc 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/connections/enums.md @@ -162,7 +162,7 @@ input ActorOptions { """ sort: [ActorSort] limit: Int - skip: Int + offset: Int } input ActorRelationInput { @@ -311,7 +311,7 @@ input MovieOptions { """ sort: [MovieSort] limit: Int - skip: Int + offset: Int } input MovieRelationInput { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md b/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md index 0c4d7390ad..43da52d228 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/connections/unions.md @@ -67,7 +67,7 @@ input AuthorOptions { """ sort: [AuthorSort] limit: Int - skip: Int + offset: Int } input AuthorPublicationsBookConnectionWhere { @@ -314,7 +314,7 @@ input BookOptions { """ sort: [BookSort] limit: Int - skip: Int + offset: Int } input BookRelationInput { @@ -463,7 +463,7 @@ input JournalOptions { """ sort: [JournalSort] limit: Int - skip: Int + offset: Int } input JournalRelationInput { @@ -533,7 +533,7 @@ type Query { } input QueryOptions { - skip: Int + offset: Int limit: Int } diff --git a/packages/graphql/tests/tck/tck-test-files/schema/custom-mutations.md b/packages/graphql/tests/tck/tck-test-files/schema/custom-mutations.md index 4ed88d19e4..915c31ffec 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/custom-mutations.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/custom-mutations.md @@ -64,7 +64,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directive-preserve.md b/packages/graphql/tests/tck/tck-test-files/schema/directive-preserve.md index ab1d1d9b0e..d3936277ed 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directive-preserve.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directive-preserve.md @@ -48,7 +48,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/access-directives.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/access-directives.md index 2a861beabc..e9a87cd595 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/access-directives.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/access-directives.md @@ -47,7 +47,7 @@ input UserOptions { """Specify one or more UserSort objects to sort Users by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [UserSort] limit: Int - skip: Int + offset: Int } """Fields to sort Users by. The order in which sorts are applied is not guaranteed when specifying many fields in one UserSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/autogenerate.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/autogenerate.md index e453da5764..dd9c589879 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/autogenerate.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/autogenerate.md @@ -44,7 +44,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/cypher.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/cypher.md index e8e821b185..1c2a211f9e 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/cypher.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/cypher.md @@ -39,7 +39,7 @@ input ActorOptions { """Specify one or more ActorSort objects to sort Actors by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [ActorSort] limit: Int - skip: Int + offset: Int } """Fields to sort Actors by. The order in which sorts are applied is not guaranteed when specifying many fields in one ActorSort object.""" @@ -91,7 +91,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/default.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/default.md index 6b666a3cd1..feca6250b3 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/default.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/default.md @@ -59,7 +59,7 @@ input UserOptions { """Specify one or more UserSort objects to sort Users by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [UserSort] limit: Int - skip: Int + offset: Int } """Fields to sort Users by. The order in which sorts are applied is not guaranteed when specifying many fields in one UserSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/exclude.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/exclude.md index b14353aca2..15697bb1e5 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/exclude.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/exclude.md @@ -73,7 +73,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" @@ -153,7 +153,7 @@ input ActorOptions { """Specify one or more ActorSort objects to sort Actors by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [ActorSort] limit: Int - skip: Int + offset: Int } """Fields to sort Actors by. The order in which sorts are applied is not guaranteed when specifying many fields in one ActorSort object.""" @@ -249,7 +249,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" @@ -346,7 +346,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" @@ -435,7 +435,7 @@ input ActorOptions { """ sort: [ActorSort] limit: Int - skip: Int + offset: Int } """ @@ -555,7 +555,7 @@ input MovieOptions { """ sort: [MovieSort] limit: Int - skip: Int + offset: Int } input MovieRelationInput { @@ -656,7 +656,7 @@ input ActorOptions { """Specify one or more ActorSort objects to sort Actors by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [ActorSort] limit: Int - skip: Int + offset: Int } """Fields to sort Actors by. The order in which sorts are applied is not guaranteed when specifying many fields in one ActorSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/ignore.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/ignore.md index a559936e4f..71db0d2394 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/ignore.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/ignore.md @@ -49,7 +49,7 @@ input UserOptions { """Specify one or more UserSort objects to sort Users by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [UserSort] limit: Int - skip: Int + offset: Int } """Fields to sort Users by. The order in which sorts are applied is not guaranteed when specifying many fields in one UserSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/private.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/private.md index 6bcf9cd86a..30dbc1863c 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/private.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/private.md @@ -42,7 +42,7 @@ input UserOptions { """Specify one or more UserSort objects to sort Users by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [UserSort] limit: Int - skip: Int + offset: Int } """Fields to sort Users by. The order in which sorts are applied is not guaranteed when specifying many fields in one UserSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/directives/timestamps.md b/packages/graphql/tests/tck/tck-test-files/schema/directives/timestamps.md index f3f878f0e5..d5717b4c9d 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/directives/timestamps.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/directives/timestamps.md @@ -49,7 +49,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/enum.md b/packages/graphql/tests/tck/tck-test-files/schema/enum.md index 9202dbffdb..72934ef354 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/enum.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/enum.md @@ -54,7 +54,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/extend.md b/packages/graphql/tests/tck/tck-test-files/schema/extend.md index c8729ee3a4..c7d127d72a 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/extend.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/extend.md @@ -47,7 +47,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/inputs.md b/packages/graphql/tests/tck/tck-test-files/schema/inputs.md index 8f911e3ca6..d738f39b57 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/inputs.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/inputs.md @@ -53,7 +53,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/interfaces.md b/packages/graphql/tests/tck/tck-test-files/schema/interfaces.md index f954e4a189..642ae0a246 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/interfaces.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/interfaces.md @@ -136,7 +136,7 @@ input MovieOptions { """ sort: [MovieSort] limit: Int - skip: Int + offset: Int } input MovieRelationInput { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/issues/#162.md b/packages/graphql/tests/tck/tck-test-files/schema/issues/#162.md index 8c811f5fd3..177546ba22 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/issues/#162.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/issues/#162.md @@ -120,7 +120,7 @@ input TigerJawLevel2Options { """ sort: [TigerJawLevel2Sort] limit: Int - skip: Int + offset: Int } type TigerJawLevel2Part1 { @@ -202,7 +202,7 @@ input TigerJawLevel2Part1Options { """ sort: [TigerJawLevel2Part1Sort] limit: Int - skip: Int + offset: Int } input TigerJawLevel2Part1RelationInput { @@ -351,7 +351,7 @@ input TigerOptions { """ sort: [TigerSort] limit: Int - skip: Int + offset: Int } """ diff --git a/packages/graphql/tests/tck/tck-test-files/schema/issues/#200.md b/packages/graphql/tests/tck/tck-test-files/schema/issues/#200.md index 85d1867473..495646d131 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/issues/#200.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/issues/#200.md @@ -39,7 +39,7 @@ input CategoryOptions { """ sort: [CategorySort] limit: Int - skip: Int + offset: Int } """ diff --git a/packages/graphql/tests/tck/tck-test-files/schema/null.md b/packages/graphql/tests/tck/tck-test-files/schema/null.md index 9bfefa5f38..be33f59015 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/null.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/null.md @@ -77,7 +77,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } enum SortDirection { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md b/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md index d4772dc8c2..734edb07a1 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/relationship-properties.md @@ -156,7 +156,7 @@ input ActorOptions { """ sort: [ActorSort] limit: Int - skip: Int + offset: Int } input ActorRelationInput { @@ -305,7 +305,7 @@ input MovieOptions { """ sort: [MovieSort] limit: Int - skip: Int + offset: Int } input MovieRelationInput { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/relationship.md b/packages/graphql/tests/tck/tck-test-files/schema/relationship.md index deffc90a10..4c0bca033b 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/relationship.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/relationship.md @@ -32,7 +32,7 @@ input ActorCreateInput { input ActorOptions { limit: Int - skip: Int + offset: Int """ Specify one or more ActorSort objects to sort Actors by. The sorts will be applied in the order in which they are arranged in the array. """ @@ -164,7 +164,7 @@ input MovieDisconnectInput { input MovieOptions { limit: Int - skip: Int + offset: Int """ Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array. """ @@ -353,7 +353,7 @@ input ActorMoviesUpdateFieldInput { input ActorOptions { limit: Int - skip: Int + offset: Int """ Specify one or more ActorSort objects to sort Actors by. The sorts will be applied in the order in which they are arranged in the array. """ @@ -495,7 +495,7 @@ input MovieDisconnectInput { input MovieOptions { limit: Int - skip: Int + offset: Int """ Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array. """ diff --git a/packages/graphql/tests/tck/tck-test-files/schema/scalar.md b/packages/graphql/tests/tck/tck-test-files/schema/scalar.md index a174471190..0cec6f67d7 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/scalar.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/scalar.md @@ -48,7 +48,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/simple.md b/packages/graphql/tests/tck/tck-test-files/schema/simple.md index 740523f94c..d1547411aa 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/simple.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/simple.md @@ -50,7 +50,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/types/bigint.md b/packages/graphql/tests/tck/tck-test-files/schema/types/bigint.md index 55258a130e..a30238aba5 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/types/bigint.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/types/bigint.md @@ -47,7 +47,7 @@ input FileOptions { """Specify one or more FileSort objects to sort Files by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [FileSort] limit: Int - skip: Int + offset: Int } """Fields to sort Files by. The order in which sorts are applied is not guaranteed when specifying many fields in one FileSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/types/date.md b/packages/graphql/tests/tck/tck-test-files/schema/types/date.md index b524d89e21..8c27805ab2 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/types/date.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/types/date.md @@ -48,7 +48,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/types/datetime.md b/packages/graphql/tests/tck/tck-test-files/schema/types/datetime.md index d79d67cfa0..0e7430484b 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/types/datetime.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/types/datetime.md @@ -48,7 +48,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" diff --git a/packages/graphql/tests/tck/tck-test-files/schema/types/points.md b/packages/graphql/tests/tck/tck-test-files/schema/types/points.md index 06e353fe51..d163f3cf5b 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/types/points.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/types/points.md @@ -61,7 +61,7 @@ input MovieOptions { """Specify one or more MovieSort objects to sort Movies by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MovieSort] limit: Int - skip: Int + offset: Int } """Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.""" @@ -164,7 +164,7 @@ input MachineOptions { """Specify one or more MachineSort objects to sort Machines by. The sorts will be applied in the order in which they are arranged in the array.""" sort: [MachineSort] limit: Int - skip: Int + offset: Int } """Fields to sort Machines by. The order in which sorts are applied is not guaranteed when specifying many fields in one MachineSort object.""" @@ -253,7 +253,7 @@ input MovieCreateInput { input MovieOptions { limit: Int - skip: Int + offset: Int } input MovieWhere { @@ -332,7 +332,7 @@ input MachineCreateInput { input MachineOptions { limit: Int - skip: Int + offset: Int } input MachineWhere { diff --git a/packages/graphql/tests/tck/tck-test-files/schema/unions.md b/packages/graphql/tests/tck/tck-test-files/schema/unions.md index 17ee90865a..588605805b 100644 --- a/packages/graphql/tests/tck/tck-test-files/schema/unions.md +++ b/packages/graphql/tests/tck/tck-test-files/schema/unions.md @@ -52,7 +52,7 @@ input GenreOptions { """ sort: [GenreSort] limit: Int - skip: Int + offset: Int } """ @@ -123,7 +123,7 @@ input MovieOptions { """ sort: [MovieSort] limit: Int - skip: Int + offset: Int } input MovieRelationInput { @@ -288,7 +288,7 @@ type Query { } input QueryOptions { - skip: Int + offset: Int limit: Int }