Skip to content

Commit edbd293

Browse files
Merge remote-tracking branch 'upstream/6.x' into add-queryDirection-changes
2 parents 7cbe6ad + 53ae99a commit edbd293

File tree

17 files changed

+129
-2636
lines changed

17 files changed

+129
-2636
lines changed

.github/workflows/auto-backport.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Cherry-pick action
1919
uses: sorenlouv/backport-github-action@929f69d04adbc196d982e60f02837b6cc00b3129
2020
with:
21-
github_token: ${{ secrets.GITHUB_TOKEN }}
21+
github_token: ${{ secrets.DOCS_AUTO_CP_TOKEN }}
2222
auto_backport_label_prefix: auto-cherry-pick-to-
2323
add_original_reviewers: true
2424

modules/ROOT/content-nav.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
** xref:subscriptions/getting-started.adoc[Getting started]
5151
** xref:subscriptions/events.adoc[Events]
5252
** xref:subscriptions/filtering.adoc[]
53-
** xref:subscriptions/scaling.adoc[]
54-
** xref:subscriptions/engines.adoc[Engines]
53+
** xref:subscriptions/customize-cdc.adoc[]
5554
5655
* *How-To*
5756

modules/ROOT/pages/directives/schema-configuration/field-configuration.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ It generates the type `Actor`:
2727
type Actor {
2828
name: String!
2929
age: Int
30-
actedIn(where: MovieWhere, options: MovieOptions, directed: Boolean = true): [Movie!]!
30+
actedIn(where: MovieWhere, sort: [MovieSort!]!, limit: Int, offset: Int, directed: Boolean = true): [Movie!]!
3131
actedInAggregate(where: MovieWhere, directed: Boolean = true): ActorMovieActedInAggregationSelection
3232
actedInConnection(where: ActorActedInConnectionWhere, first: Int, after: String, directed: Boolean = true, sort: [ActorActedInConnectionSort!]): ActorActedInConnection!
3333
}
@@ -56,7 +56,7 @@ Now the type `Actor` looks like this:
5656
----
5757
type Actor {
5858
name: String!
59-
actedIn(where: MovieWhere, options: MovieOptions, directed: Boolean = true): [Movie!]!
59+
actedIn(where: MovieWhere, sort: [MovieSort!]!, limit: Int, offset: Int, directed: Boolean = true): [Movie!]!
6060
actedInAggregate(where: MovieWhere, directed: Boolean = true): ActorMovieActedInAggregationSelection
6161
actedInConnection(where: ActorActedInConnectionWhere, first: Int, after: String, directed: Boolean = true, sort: [ActorActedInConnectionSort!]): ActorActedInConnection!
6262
}
@@ -105,7 +105,7 @@ From the previous type definitions, the type `Actor` produced is:
105105
----
106106
type Actor {
107107
name: String!
108-
actedIn(where: MovieWhere, options: MovieOptions, directed: Boolean = true): [Movie!]!
108+
actedIn(where: MovieWhere, sort: [MovieSort!]!, limit: Int, offset: Int, directed: Boolean = true): [Movie!]!
109109
actedInAggregate(where: MovieWhere, directed: Boolean = true): ActorMovieActedInAggregationSelection
110110
actedInConnection(where: ActorActedInConnectionWhere, first: Int, after: String, directed: Boolean = true, sort: [ActorActedInConnectionSort!]): ActorActedInConnection!
111111
}
@@ -135,7 +135,7 @@ In this case, as the argument `aggregate` was passed as false, the type `Actor`
135135
type Actor {
136136
name: String!
137137
age: Int
138-
actedIn(where: MovieWhere, options: MovieOptions, directed: Boolean = true): [Movie!]!
138+
actedIn(where: MovieWhere, sort: [MovieSort!]!, limit: Int, offset: Int, directed: Boolean = true): [Movie!]!
139139
actedInConnection(where: ActorActedInConnectionWhere, first: Int, after: String, directed: Boolean = true, sort: [ActorActedInConnectionSort!]): ActorActedInConnection!
140140
}
141141
----
@@ -269,7 +269,7 @@ From the previous type definitions, the type `Actor` produced is:
269269
----
270270
type Actor {
271271
name: String!
272-
actedIn(where: MovieWhere, options: MovieOptions, directed: Boolean = true): [Movie!]!
272+
actedIn(where: MovieWhere, sort: [MovieSort!]!, limit: Int, offset: Int, directed: Boolean = true): [Movie!]!
273273
actedInAggregate(where: MovieWhere, directed: Boolean = true): ActorMovieActedInAggregationSelection
274274
actedInConnection(where: ActorActedInConnectionWhere, first: Int, after: String, directed: Boolean = true, sort: [ActorActedInConnectionSort!]): ActorActedInConnection!
275275
}
@@ -437,7 +437,7 @@ input MovieWhere {
437437
OR: [MovieWhere!]
438438
AND: [MovieWhere!]
439439
NOT: MovieWhere
440-
title: String
440+
title_EQ: String
441441
title_IN: [String!]
442442
title_CONTAINS: String
443443
title_STARTS_WITH: String
@@ -507,7 +507,7 @@ input MovieWhere {
507507
OR: [MovieWhere!]
508508
AND: [MovieWhere!]
509509
NOT: MovieWhere
510-
title: String
510+
title_EQ: String
511511
title_IN: [String!]
512512
title_CONTAINS: String
513513
title_STARTS_WITH: String

modules/ROOT/pages/directives/schema-configuration/type-configuration.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,9 @@ enum SubscriptionFields {
118118
CREATED
119119
UPDATED
120120
DELETED
121-
RELATIONSHIP_CREATED
122-
RELATIONSHIP_DELETED
123121
}
124122
125-
directive @subscription(events: [SubscriptionFields!]! = [CREATED, UPDATED, DELETED, RELATIONSHIP_CREATED, RELATIONSHIP_DELETED]) on OBJECT | SCHEMA
123+
directive @subscription(events: [SubscriptionFields!]! = [CREATED, UPDATED, DELETE]) on OBJECT | SCHEMA
126124
----
127125

128126
=== Usage

modules/ROOT/pages/migration/index.adoc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,56 @@ The minimum Node.js version required to run the Neo4j GraphQL Library is now 20.
2828

2929
The minimum Neo4j version required to run the Neo4j GraphQL Library is now 5.0.0.
3030

31+
32+
=== Removed Non-CDC subscriptions
33+
34+
Support for subscription engines other than `Neo4jGraphQLSubscriptionsCDCEngine` has been dropped.
35+
This means subscriptions only work on databases with Change Data Capture (CDC) enabled. The following engines are no longer supported:
36+
37+
* Neo4jGraphQLSubscriptionsDefaultEngine
38+
* link:https://www.npmjs.com/package/@neo4j/graphql-amqp-subscriptions-engine[Neo4jGraphQLAMQPSubscriptionsEngine]
39+
40+
==== Changed default subscription engine
41+
42+
When setting up the default subscriptions for Neo4jGraphQL, now the production-ready CDC engine is used (`Neo4jGraphQLSubscriptionsCDCEngine`) instead of the previous default engine:
43+
44+
[source, javascript]
45+
----
46+
new Neo4jGraphQL({
47+
typeDefs,
48+
driver,
49+
features: {
50+
subscriptions: true
51+
},
52+
});
53+
----
54+
55+
This means the default subscriptions now require CDC enabled in your database.
56+
57+
==== Removed relationship subscriptions
58+
59+
The subscriptions operations `*RelationshipCreated` and `*RelationshipDeleted` are no longer supported.
60+
61+
For example:
62+
63+
[source, graphql, indent=0]
64+
----
65+
subscription MovieRelationshipDeleted {
66+
movieRelationshipCreated {
67+
movie {
68+
title
69+
}
70+
createdRelationship {
71+
actors {
72+
node {
73+
name
74+
}
75+
}
76+
}
77+
}
78+
}
79+
----
80+
3181
=== Removed the deprecated implicit "some" filter from `@relationship`
3282

3383
The deprecated implicit "some" filter without operator suffix has been removed from `@relationship` in favor of the explicit `_SOME` filter.

modules/ROOT/pages/optimization.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ const neoSchema = new Neo4jGraphQL({
2323
driver,
2424
features: {
2525
excludeDeprecatedFields: {
26-
bookmark: true,
27-
negationFilters: true,
28-
arrayFilters: true,
29-
stringAggregation: true,
30-
aggregationFilters: true,
26+
implicitEqualFilters: true;
27+
deprecatedOptionsArgument: true;
28+
directedArgument: true;
3129
},
3230
},
3331
});
3432
```
3533

34+
;
35+

modules/ROOT/pages/queries-aggregations/aggregations.adoc

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ For which the following query fields are generated:
3333
[source, graphql, indent=0]
3434
----
3535
type Query {
36-
posts(where: PostWhere, options: PostOptions): [Post!]!
36+
posts(where: PostWhere, sort: [PostSort!]!, limit: Int, offset: Int,): [Post!]!
3737
postsAggregate(where: PostWhere): PostAggregationSelection!
3838
39-
users(where: UserWhere, options: UserOptions): [User!]!
39+
users(where: UserWhere, sort: [UserSort!]!, limit: Int, offset: Int,): [User!]!
4040
usersAggregate(where: UserWhere): UserAggregationSelection!
4141
}
4242
----
@@ -180,17 +180,3 @@ query {
180180
}
181181
----
182182

183-
When performing an aggregation on related nodes, the query against the relationship
184-
can be defined as "undirected" by using the argument `directed: false`:
185-
186-
[source, graphql, indent=0]
187-
----
188-
query {
189-
users {
190-
id
191-
postsAggregate(directed: false) {
192-
count
193-
}
194-
}
195-
}
196-
----

modules/ROOT/pages/queries-aggregations/pagination/offset-based.adoc

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ You would fetch the first "page" of 10 by executing:
1818
[source, graphql, indent=0]
1919
----
2020
query {
21-
users(options: {
22-
limit: 10
23-
}) {
21+
users(limit: 10) {
2422
name
2523
}
2624
}
@@ -33,10 +31,7 @@ And then on subsequent calls, introduce the `offset` argument and increment it b
3331
[source, graphql, indent=0]
3432
----
3533
query {
36-
users(options: {
37-
offset: 10
38-
limit: 10
39-
}) {
34+
users(offset: 10, limit: 10) {
4035
name
4136
}
4237
}
@@ -47,10 +42,7 @@ query {
4742
[source, graphql, indent=0]
4843
----
4944
query {
50-
users(options: {
51-
offset: 20
52-
limit: 10
53-
}) {
45+
users(offset: 20, limit: 10) {
5446
name
5547
}
5648
}
@@ -75,10 +67,7 @@ query {
7567
name_EQ: "Billy"
7668
}) {
7769
name
78-
posts(options: {
79-
offset: 20
80-
limit: 10
81-
}) {
70+
posts(offset: 20, limit: 10) {
8271
content
8372
}
8473
}

modules/ROOT/pages/queries-aggregations/queries.adoc

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ For which the following query fields are generated:
3333
[source, graphql, indent=0]
3434
----
3535
type Query {
36-
posts(where: PostWhere, options: PostOptions): [Post!]!
36+
posts(where: PostWhere, sort: [PostSort!]!, limit: Int, offset: Int,): [Post!]!
3737
postsAggregate(where: PostWhere): PostAggregationSelection!
3838
39-
users(where: UserWhere, options: UserOptions): [User!]!
39+
users(where: UserWhere, sort: [UserSort!]!, limit: Int, offset: Int,): [User!]!
4040
usersAggregate(where: UserWhere): UserAggregationSelection!
4141
}
4242
----
@@ -69,45 +69,3 @@ query {
6969
}
7070
}
7171
----
72-
73-
== Undirected queries
74-
75-
All xref::/types/relationships.adoc[relationships] are created with a direction from one node to another.
76-
By default, all queries follow the direction defined in the relationship.
77-
However, in some cases it is necessary to query for all related nodes, regardless of the direction of the relationship.
78-
This can be achieved with the argument `directed: false`.
79-
80-
For example, the following query should return all User friends, regardless of the direction of the relationship `"FRIENDS_WITH"`:
81-
82-
[source, graphql, indent=0]
83-
----
84-
query {
85-
users {
86-
name
87-
friends: friends(directed: false) {
88-
name
89-
}
90-
}
91-
}
92-
----
93-
94-
In addition, undirected relationships can also be used in the same fashion with connections.
95-
For instance, this query is asking for a list of users and their friends' names with an undirected friendship connection:
96-
97-
[source, graphql, indent=0]
98-
----
99-
query Query {
100-
users {
101-
friendsConnection(directed: false) {
102-
edges {
103-
node {
104-
name
105-
}
106-
}
107-
}
108-
}
109-
}
110-
----
111-
112-
Keep in mind that *undirected relationships are only supported in queries*.
113-
The xref::/types/relationships.adoc#_querydirection[type definitions] for a relationship may define a different behavior, so the `directed` option may not be available in some cases.

modules/ROOT/pages/queries-aggregations/sorting.adoc

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,8 @@ input MovieSort {
3535
runtime: SortDirection
3636
}
3737
38-
input MovieOptions {
39-
"""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."""
40-
sort: [MovieSort!]
41-
limit: Int
42-
offset: Int
43-
}
44-
4538
type Query {
46-
movies(where: MovieWhere, options: MovieOptions): [Movie!]!
39+
movies(where: MovieWhere, sort: [MovieSort!], limit: Int, offset: Int): [Movie!]!
4740
}
4841
----
4942

@@ -52,13 +45,12 @@ The following query fetches all movies sorted by runtime in ascending order:
5245
[source, graphql, indent=0]
5346
----
5447
query {
55-
movies(options: {
56-
sort: [
48+
movies(sort: [
5749
{
5850
runtime: ASC
5951
}
6052
]
61-
}) {
53+
) {
6254
title
6355
runtime
6456
}
@@ -73,13 +65,12 @@ query {
7365
movies {
7466
title
7567
runtime
76-
actors(options: {
77-
sort: [
68+
actors(sort: [
7869
{
7970
surname: ASC
8071
}
8172
]
82-
}) {
73+
) {
8374
surname
8475
}
8576
}

0 commit comments

Comments
 (0)