neo4j / neo4j-javascript-driver

Neo4j Bolt driver for JavaScript
https://neo4j.com/docs/javascript-manual/current/
Apache License 2.0
839 stars 148 forks source link

Introduce `GqlStatusObject` support as notifications to `ResultSummary` #1194

Closed bigmontz closed 1 week ago

bigmontz commented 1 month ago

⚠️ This API is released as preview.

Introduces ResultSummary.gqlStatusObjects as preview feature.

GqlStatusObject is a GQL compliant Notification object and status of query execution, this new object includes gqlStatus and statusDescription.

ResultSummary.gqlStatusObjects always contains at least 1 status representing the Success, No Data or Omitted Result. When discarding records in a RxSession while connected to a non-GQL-aware server, the driver might not be able to tell apart Success and No Data.

The GqlStatusObjects will be presented in the following order:

Migrating from Notification

Most of the properties present in the Notification are present in the new object, except code and title. The GqlStatusObject.gqlStatus is equivalent of code in the Notification, but with values compliant with GQL. The properties GqlStatusObject.classification and GqlStatusObject.rawClassification are equivalent to Notification.category and Notification.rawCategory. The name change is needed because category has a different meaning in GQL.

Configuration

Filtering gqlStatusObjects can be done using in the same way as filtering notifications. However, non-notification status can not be filtered (such as Success or No Data). The property disabledClassifications was added to NotificationFilter for being named consistently with GQL. This property is equivalent to disabledCategories and it be can used interchangeably. However, they can not be used at the same time. An exception will be raised in this scenario.

⚠️ This API is released as preview.

robsdedude commented 3 weeks ago

PR description is not up-to-date.

ResultSummary.gqlStatusObjects always contains at least 1 status representing the Success, No Data or Omitted Result. This status will be always the first one.

I thought this isn't the case.

When discarding records while connected to a non-GQL aware server, the driver might not be able to tell apart Success and No Data.

This only applies to the reactive driver, doesn't it? Might be worth being explicit here.

All following status are notifications like warnings about problematic queries or other valuable information that can be presented in a client.

See first point.