Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated directed argument #5778

Merged
merged 8 commits into from
Nov 13, 2024
5 changes: 5 additions & 0 deletions .changeset/healthy-swans-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@neo4j/graphql": major
darrellwarde marked this conversation as resolved.
Show resolved Hide resolved
---

The deprecated `directed` argument has been removed, and `queryDirection` now only accepts two possible values - `DIRECTED` (default) and `UNDIRECTED`.
4 changes: 0 additions & 4 deletions packages/graphql/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export const LOGICAL_OPERATORS = ["AND", "OR", "NOT"] as const;
export const AGGREGATION_COMPARISON_OPERATORS = ["EQUAL", "GT", "GTE", "LT", "LTE"] as const;

export enum RelationshipQueryDirectionOption {
DEFAULT_DIRECTED = "DEFAULT_DIRECTED",
DEFAULT_UNDIRECTED = "DEFAULT_UNDIRECTED",
DIRECTED_ONLY = "DIRECTED_ONLY",
UNDIRECTED_ONLY = "UNDIRECTED_ONLY",
DIRECTED = "DIRECTED",
UNDIRECTED = "UNDIRECTED",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ import { RelationshipQueryDirectionOption } from "../../../../constants";
export const RelationshipQueryDirectionEnum = new GraphQLEnumType({
name: "RelationshipQueryDirection",
values: {
[RelationshipQueryDirectionOption.DEFAULT_DIRECTED]: {
deprecationReason:
"DEFAULT_DIRECTED is deprecated without alternative and it will be removed in future versions, this is following the deprecation of the generated `directed` argument",
},
[RelationshipQueryDirectionOption.DEFAULT_UNDIRECTED]: {
deprecationReason:
"DEFAULT_UNDIRECTED is deprecated without alternative and it will be removed in future versions, this is following the deprecation of the generated `directed` argument",
},
[RelationshipQueryDirectionOption.DIRECTED_ONLY]: {
deprecationReason: "DIRECTED_ONLY is deprecated, please use DIRECTED.",
},
[RelationshipQueryDirectionOption.UNDIRECTED_ONLY]: {
deprecationReason: "UNDIRECTED_ONLY is deprecated, please use UNDIRECTED.",
},
[RelationshipQueryDirectionOption.DIRECTED]: {},
[RelationshipQueryDirectionOption.UNDIRECTED]: {},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/src/graphql/directives/relationship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const relationshipDirective = new GraphQLDirective({
},
queryDirection: {
type: RelationshipQueryDirectionEnum,
defaultValue: RelationshipQueryDirectionOption.DEFAULT_DIRECTED,
description: "Valid and default directions for this relationship.",
defaultValue: RelationshipQueryDirectionOption.DIRECTED,
description: "Directions to query this relationship.",
},
direction: {
type: new GraphQLNonNull(RelationshipDirectionEnum),
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/src/schema-model/generate-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ describe("Relationship", () => {
expect(accounts).toBeDefined();
expect(accounts?.type).toBe("HAS_ACCOUNT");
expect(accounts?.direction).toBe("OUT");
expect(accounts?.queryDirection).toBe("DEFAULT_DIRECTED");
expect(accounts?.queryDirection).toBe("DIRECTED");
expect(accounts?.nestedOperations).toEqual([
"CREATE",
"UPDATE",
Expand Down Expand Up @@ -427,7 +427,7 @@ describe("Relationship", () => {
expect(actors).toBeDefined();
expect(actors?.type).toBe("STARED_IN");
expect(actors?.direction).toBe("OUT");
expect(actors?.queryDirection).toBe("DEFAULT_DIRECTED");
expect(actors?.queryDirection).toBe("DIRECTED");
expect(actors?.nestedOperations).toEqual([
"CREATE",
"UPDATE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import type { Attribute } from "../attribute/Attribute";
import type { Entity } from "../entity/Entity";

export type RelationshipDirection = "IN" | "OUT";
// "DIRECTED" | "UNDIRECTED";
export type QueryDirection = keyof typeof RelationshipQueryDirectionOption;
// "DEFAULT_DIRECTED" | "DEFAULT_UNDIRECTED" | "DIRECTED_ONLY" | "UNDIRECTED_ONLY" | "DIRECTED" | "UNDIRECTED";
export type NestedOperation = keyof typeof RelationshipNestedOperationsOption;
// "CREATE" | "UPDATE" | "DELETE" | "CONNECT" | "DISCONNECT" | "CONNECT_OR_CREATE";
export type NestedOperation = keyof typeof RelationshipNestedOperationsOption;

export class Relationship {
public readonly name: string; // name of the relationship field, e.g. friends
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe("RelationshipAdapter", () => {
direction: "OUT",
isList: Boolean(false),
attributes: [accountAlias],
queryDirection: "DEFAULT_DIRECTED",
queryDirection: "DIRECTED",
nestedOperations: ["CREATE", "UPDATE", "DELETE", "CONNECT", "DISCONNECT", "CONNECT_OR_CREATE"],
aggregate: false,
description: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export class RelationshipAdapter {
* @param directed the direction asked during the query, for instance "friends(directed: true)"
* @returns the direction to use in the CypherBuilder
**/
public getCypherDirection(directed?: boolean): "left" | "right" | "undirected" {
if (directed === false || this.queryDirection === "UNDIRECTED_ONLY" || this.queryDirection === "UNDIRECTED") {
public getCypherDirection(): "left" | "right" | "undirected" {
if (this.queryDirection === "UNDIRECTED") {
return "undirected";
}
return this.cypherDirectionFromRelDirection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { RelationshipAdapter } from "../../schema-model/relationship/model-adapt
import { RelationshipDeclarationAdapter } from "../../schema-model/relationship/model-adapters/RelationshipDeclarationAdapter";
import type { Neo4jFeaturesSettings } from "../../types";
import { FieldAggregationComposer } from "../aggregations/field-aggregation-composer";
import { addDirectedArgument } from "../directed-argument";
import {
augmentObjectOrInterfaceTypeWithConnectionField,
augmentObjectOrInterfaceTypeWithRelationshipField,
Expand Down Expand Up @@ -264,13 +263,11 @@ export function createRelationshipFields({
where: relationshipTarget.operations.whereInputTypeName,
};

const aggregationFieldsArgs = addDirectedArgument(aggregationFieldsBaseArgs, relationshipAdapter, features);

if (relationshipAdapter.aggregate) {
composeNode.addFields({
[relationshipAdapter.operations.aggregateTypeName]: {
type: aggregationTypeObject,
args: aggregationFieldsArgs,
args: aggregationFieldsBaseArgs,
directives: deprecatedDirectives,
},
});
Expand Down
157 changes: 0 additions & 157 deletions packages/graphql/src/schema/directed-argument.test.ts

This file was deleted.

74 changes: 0 additions & 74 deletions packages/graphql/src/schema/directed-argument.ts

This file was deleted.

Loading
Loading