neo4j-ruby-driver 6.2.1-java → 6.3.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Jars.lock +2 -2
  3. data/README.md +9 -0
  4. data/lib/neo4j/driver/auto_closeable.rb +3 -0
  5. data/lib/neo4j/driver/exceptions/neo4j_exception.rb +6 -0
  6. data/lib/neo4j/driver/exceptions/no_such_record_exception.rb +2 -0
  7. data/lib/neo4j/driver/exceptions/value/lossy_coercion.rb +2 -0
  8. data/lib/neo4j/driver/exceptions/value/not_multi_valued.rb +2 -0
  9. data/lib/neo4j/driver/exceptions/value/uncoercible.rb +2 -0
  10. data/lib/neo4j/driver/exceptions/value/unsizable.rb +2 -0
  11. data/lib/neo4j/driver/exceptions/value/value_exception.rb +2 -0
  12. data/lib/neo4j/driver/ext/auth_tokens.rb +2 -0
  13. data/lib/neo4j/driver/ext/config_converter.rb +3 -0
  14. data/lib/neo4j/driver/ext/exception_checkable.rb +5 -0
  15. data/lib/neo4j/driver/ext/exception_mapper.rb +4 -0
  16. data/lib/neo4j/driver/ext/graph_database.rb +2 -0
  17. data/lib/neo4j/driver/ext/internal/abstract_query_runner.rb +4 -0
  18. data/lib/neo4j/driver/ext/internal/cluster/routing_table_registry_impl.rb +25 -18
  19. data/lib/neo4j/driver/ext/internal/eager_result_value.rb +2 -0
  20. data/lib/neo4j/driver/ext/internal/internal_notification_severity.rb +2 -0
  21. data/lib/neo4j/driver/ext/internal/metrics/internal_connection_pool_metrics.rb +2 -0
  22. data/lib/neo4j/driver/ext/internal/summary/internal_notification.rb +4 -0
  23. data/lib/neo4j/driver/ext/internal/summary/internal_plan.rb +2 -0
  24. data/lib/neo4j/driver/ext/internal/summary/internal_result_summary.rb +3 -0
  25. data/lib/neo4j/driver/ext/internal_driver.rb +3 -0
  26. data/lib/neo4j/driver/ext/internal_entity.rb +2 -0
  27. data/lib/neo4j/driver/ext/internal_keys.rb +1 -0
  28. data/lib/neo4j/driver/ext/internal_node.rb +1 -0
  29. data/lib/neo4j/driver/ext/internal_record.rb +2 -0
  30. data/lib/neo4j/driver/ext/internal_relationship.rb +1 -0
  31. data/lib/neo4j/driver/ext/internal_result.rb +2 -0
  32. data/lib/neo4j/driver/ext/internal_session.rb +3 -0
  33. data/lib/neo4j/driver/ext/internal_transaction.rb +2 -0
  34. data/lib/neo4j/driver/ext/logger.rb +2 -0
  35. data/lib/neo4j/driver/ext/map_converter.rb +2 -0
  36. data/lib/neo4j/driver/ext/neo_converter.rb +5 -2
  37. data/lib/neo4j/driver/ext/plain_map_converter.rb +2 -0
  38. data/lib/neo4j/driver/ext/query.rb +2 -0
  39. data/lib/neo4j/driver/ext/ruby_converter.rb +2 -0
  40. data/lib/neo4j/driver/ext/run_override.rb +2 -0
  41. data/lib/neo4j/driver/ext/start_end_naming.rb +2 -0
  42. data/lib/neo4j/driver/internal/deprecator.rb +2 -0
  43. data/lib/neo4j/driver/internal/duration_normalizer.rb +4 -0
  44. data/lib/neo4j/driver/internal/validator.rb +2 -0
  45. data/lib/neo4j/driver/internal/zone_identifier.rb +34 -0
  46. data/lib/neo4j/driver/types/duration.rb +1 -1
  47. data/lib/neo4j/driver/version.rb +1 -1
  48. data/lib/neo4j/driver.rb +7 -0
  49. data/lib/neo4j-ruby-driver.rb +2 -0
  50. data/lib/neo4j-ruby-driver_jars.rb +4 -4
  51. data/lib/neo4j-ruby-driver_loader.rb +2 -0
  52. data/lib/neo4j_ruby_driver.rb +2 -0
  53. data/lib/org/neo4j/driver/neo4j-java-driver-all/{6.2.1/neo4j-java-driver-all-6.2.1.jar → 6.3.0/neo4j-java-driver-all-6.3.0.jar} +0 -0
  54. data/lib/org/neo4j/driver/neo4j-java-driver-observation-metrics/{6.2.1/neo4j-java-driver-observation-metrics-6.2.1.jar → 6.3.0/neo4j-java-driver-observation-metrics-6.3.0.jar} +0 -0
  55. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0503657b21b0b995eb8c26f10fc37b2c778339194b664bdfaf0d78e6c65878cb
4
- data.tar.gz: cbaf03d51166db1931fe73a6593928ede782f5afe7f045dfadb081bc491ec30a
3
+ metadata.gz: 2cdbc720e3f878a5a25a134c47a9c043b39e462a1e7e3aa514224d6abe858360
4
+ data.tar.gz: 36cc79e4ef8b0c0c1e745f80d25910c279d36a07a6ed5fcc04328d8e5080d5f6
5
5
  SHA512:
6
- metadata.gz: 054df2db790d00418e84c5bad8f71e401f887ec820068b1538b9e7abe0571dffdd087b4b4ad063fc338a4ef1e48af7742624d516e2c16c30e32b45724e6346e5
7
- data.tar.gz: 1c3cb6b394f09186f1c533e657c99ebf79bdc165e5497e23c3fcf751a6fa81e082d407426e4c82284999ac56d8a45f137d00fdd9a031d99f7e5e1d80f7489daf
6
+ metadata.gz: 48faecd144151ecd2ed9e6b9b3439bad201e9c4e75186033bdbd3331aa8f9cb7652e7fb3bdc77cbfcf312f6e859c333eab634a4d12230a2d84125457e5698961
7
+ data.tar.gz: b2d90351ea17b765c931acc886b77491329d0ee9d2994522ab9e3c0051951ce7aad127e7e8aff11569011163e85594865b53411801c0ad0da5725b4a1f1fa552
data/Jars.lock CHANGED
@@ -1,3 +1,3 @@
1
- org.neo4j.driver:neo4j-java-driver-all:6.2.1:compile:
1
+ org.neo4j.driver:neo4j-java-driver-all:6.3.0:compile:
2
2
  org.reactivestreams:reactive-streams:1.0.4:compile:
3
- org.neo4j.driver:neo4j-java-driver-observation-metrics:6.2.1:compile:
3
+ org.neo4j.driver:neo4j-java-driver-observation-metrics:6.3.0:compile:
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Neo4j Ruby Driver
2
2
 
3
+ [![codecov](https://codecov.io/gh/neo4jrb/neo4j-ruby-driver/branch/main/graph/badge.svg)](https://codecov.io/gh/neo4jrb/neo4j-ruby-driver)
4
+
3
5
  A driver for [Neo4j](https://neo4j.com) that speaks the
4
6
  [Bolt protocol](https://neo4j.com/docs/bolt/current/), with **two
5
7
  implementations behind one public Ruby API**:
@@ -126,6 +128,13 @@ age = record[1] # or by index
126
128
  records = result.to_a
127
129
  ```
128
130
 
131
+ Node labels and relationship types come back as **symbols** off the entity —
132
+ `node.labels # => [:Person]`, `rel.type # => :KNOWS` — as do record columns and
133
+ map/property keys. Cypher functions that *return* strings (`labels()`, `keys()`,
134
+ `type()`) return **strings**, because their result is an ordinary value on the
135
+ wire, indistinguishable from data you returned yourself. Read the accessor for
136
+ symbols, or convert the function result with `.map(&:to_sym)`.
137
+
129
138
  ## Architecture
130
139
 
131
140
  The development tree is split so shared code lives in one place and each
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
+ # Class-level helper: wraps the named factory methods so that, when given
6
+ # a block, the returned resource is yielded and guaranteed closed
7
+ # afterwards (Java try-with-resources semantics).
5
8
  module AutoCloseable
6
9
  def auto_closeable(*methods)
7
10
  prepend with_block_definer(methods)
@@ -3,6 +3,12 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
+ # Base class for the driver's Neo4j-error exceptions — those carrying a
7
+ # server error code plus the GQL status fields (status, description,
8
+ # classification, cause, diagnostic record) and a list of suppressed
9
+ # exceptions. (A few driver exceptions — NoSuchRecordException,
10
+ # IllegalStateException, UntrustedServerException — subclass RuntimeError
11
+ # directly and sit outside this hierarchy.)
6
12
  class Neo4jException < RuntimeError
7
13
  attr_reader :code, :suppressed, :gql_status, :status_description,
8
14
  :classification, :raw_classification, :diagnostic_record, :gql_cause
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
+ # Raised when a single record is requested but the result is empty or
7
+ # holds more than one, or when iteration/peek runs past the last record.
6
8
  class NoSuchRecordException < RuntimeError
7
9
  EMPTY = 'Cannot retrieve a single record, because this result is empty.'
8
10
  TOO_MANY = 'Expected a result with a single record, but this result ' \
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Neo4j
2
4
  module Driver
3
5
  module Exceptions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Neo4j
2
4
  module Driver
3
5
  module Exceptions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Neo4j
2
4
  module Driver
3
5
  module Exceptions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Neo4j
2
4
  module Driver
3
5
  module Exceptions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Neo4j
2
4
  module Driver
3
5
  module Exceptions
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Prepended onto Java's AuthTokens factory: validates credentials and
7
+ # converts the custom-token parameters Hash into a Java Map.
6
8
  module AuthTokens
7
9
  include NeoConverter
8
10
 
@@ -3,6 +3,9 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Translates the Ruby config Hash into Java Config builder calls —
7
+ # timeouts to Duration, trust/notification/revocation strategies, and
8
+ # resolver/bookmark procs wrapped as Java functional interfaces.
6
9
  module ConfigConverter
7
10
  include NeoConverter
8
11
  include Driver::Internal::DurationNormalizer
@@ -3,6 +3,11 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Wraps Java-driver calls at the exception boundary: `check` rescues Java
7
+ # RuntimeExceptions and re-raises them as the mapped Ruby exception;
8
+ # `reverse_check` turns the driver's own Ruby exceptions raised in user
9
+ # callbacks back into the Java exceptions the Java driver expects (reusing
10
+ # the original Java cause when one is present).
6
11
  module ExceptionCheckable
7
12
  include ExceptionMapper
8
13
 
@@ -3,6 +3,10 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Maps org.neo4j.driver Java exceptions to the shared Ruby exception
7
+ # hierarchy, carrying across the error code and GQL status fields as Ruby
8
+ # values. The exception the caller rescues is always a Ruby type; its
9
+ # #cause may still retain the original Java throwable for debugging.
6
10
  module ExceptionMapper
7
11
  java_import org.neo4j.driver.exceptions.AuthenticationException
8
12
  java_import org.neo4j.driver.exceptions.AuthorizationExpiredException
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Prepended onto Java's GraphDatabase entry point: builds a driver from a
7
+ # URI, an auth token or token manager, and the converted Ruby config.
6
8
  module GraphDatabase
7
9
  extend AutoCloseable
8
10
  include ConfigConverter
@@ -4,6 +4,10 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module Internal
7
+ # Shared run() override for query runners (sessions, transactions):
8
+ # builds a Neo4j::Driver::Query from the Ruby query text and parameters
9
+ # (via RunOverride#to_statement) and routes the call through #check, so a
10
+ # Java exception comes back as the driver's Ruby exception.
7
11
  module AbstractQueryRunner
8
12
  include ExceptionCheckable
9
13
  include RunOverride
@@ -1,25 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Neo4j::Driver::Ext
4
- module Internal
5
- module Cluster
6
- module RoutingTableRegistryImpl
7
- def routing_table_handler(database)
8
- if database
9
- it = get_routing_table_handler(Neo4j::Driver::Internal::DatabaseName.database(database))
10
- raise KeyError, "No routing table for database #{database.inspect}" unless it.present?
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module Internal
7
+ module Cluster
8
+ # Resolves a routing-table handler by database name, or the single
9
+ # default/home table when none is given, backing testkit's
10
+ # GetRoutingTable request.
11
+ module RoutingTableRegistryImpl
12
+ def routing_table_handler(database)
13
+ if database
14
+ it = get_routing_table_handler(Neo4j::Driver::Internal::DatabaseName.database(database))
15
+ raise KeyError, "No routing table for database #{database.inspect}" unless it.present?
11
16
 
12
- it.get
13
- else
14
- # The default/home database is keyed under the server-resolved
15
- # name, not defaultDatabase(); in the single-table stub case
16
- # (testkit's get_routing_table() with no database) return it.
17
- handlers = Reflection.field(self, 'routingTableHandlers').values
18
- unless handlers.size == 1
19
- raise KeyError, "Cannot resolve default routing table (#{handlers.size} present; specify a database)"
20
- end
17
+ it.get
18
+ else
19
+ # The default/home database is keyed under the server-resolved
20
+ # name, not defaultDatabase(); in the single-table stub case
21
+ # (testkit's get_routing_table() with no database) return it.
22
+ handlers = Reflection.field(self, 'routingTableHandlers').values
23
+ unless handlers.size == 1
24
+ raise KeyError, "Cannot resolve default routing table (#{handlers.size} present; specify a database)"
25
+ end
21
26
 
22
- handlers.first
27
+ handlers.first
28
+ end
29
+ end
23
30
  end
24
31
  end
25
32
  end
@@ -4,6 +4,8 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module Internal
7
+ # Prepended onto the Java EagerResult (execute_query result):
8
+ # materialises its records as a Ruby Array.
7
9
  module EagerResultValue
8
10
  include InternalKeys
9
11
 
@@ -4,6 +4,8 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module Internal
7
+ # Exposes the Java notification severity's `type` under the Ruby
8
+ # driver's `name` accessor.
7
9
  module InternalNotificationSeverity
8
10
  extend Forwardable
9
11
 
@@ -5,6 +5,8 @@ module Neo4j
5
5
  module Ext
6
6
  module Internal
7
7
  module Metrics
8
+ # Reads the protected getAddress off the Java connection-pool-metrics
9
+ # object via reflection, exposing it as the pool's address.
8
10
  module InternalConnectionPoolMetrics
9
11
  def address
10
12
  java_class.declared_method('getAddress').tap { |m| m.accessible = true }.invoke(java_object)
@@ -1,8 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Neo4j
2
4
  module Driver
3
5
  module Ext
4
6
  module Internal
5
7
  module Summary
8
+ # Unwraps the Java notification's Optional severity and category
9
+ # getters to a plain value or nil.
6
10
  module InternalNotification
7
11
  def severity_level
8
12
  super.or_else(nil)
@@ -5,6 +5,8 @@ module Neo4j
5
5
  module Ext
6
6
  module Internal
7
7
  module Summary
8
+ # Ruby-ifies the Java execution plan: its arguments as a Hash of
9
+ # native Ruby values and its identifiers as an Array.
8
10
  module InternalPlan
9
11
  # Ruby-idiomatic args: Java Map<String, Value> → Hash with
10
12
  # native Ruby values. Symmetric with MRI Plan#arguments
@@ -5,6 +5,9 @@ module Neo4j
5
5
  module Ext
6
6
  module Internal
7
7
  module Summary
8
+ # Ruby-ifies the Java result summary: the available/consumed timings
9
+ # in milliseconds (nil when absent), the 6.2 queryProfile, and the
10
+ # query-type enum mapped to the shared Ruby QueryType.
8
11
  module InternalResultSummary
9
12
  %i[result_available_after result_consumed_after].each do |method|
10
13
  define_method(method) do
@@ -3,6 +3,9 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Prepended onto Java's InternalDriver: execute_query, session creation
7
+ # (with per-session auth), connectivity/auth verification, and
8
+ # routing-table access and refresh used by testkit.
6
9
  module InternalDriver
7
10
  extend AutoCloseable
8
11
  include ConfigConverter
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Shared Node/Relationship behaviour: property lookup coerced to Ruby
7
+ # values, `properties` as a Hash, and Java value-equality for `==`.
6
8
  module InternalEntity
7
9
  include MapConverter
8
10
 
@@ -3,6 +3,7 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Returns a result's or record's column keys as symbols.
6
7
  module InternalKeys
7
8
  include ExceptionCheckable
8
9
 
@@ -3,6 +3,7 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Returns a node's labels as symbols.
6
7
  module InternalNode
7
8
  def labels
8
9
  super.map(&:to_sym)
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Record access: values and positional- or key-based lookups coerced to
7
+ # Ruby objects, with keys exposed as symbols.
6
8
  module InternalRecord
7
9
  include MapConverter
8
10
  include InternalKeys
@@ -3,6 +3,7 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Returns a relationship's type as a symbol.
6
7
  module InternalRelationship
7
8
  def type
8
9
  super.to_sym
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Wraps the Java Result as a Ruby Enumerable, mapping exceptions on every
7
+ # traversal (next/peek/consume/single/each/to_a).
6
8
  module InternalResult
7
9
  include Enumerable
8
10
  include ExceptionCheckable
@@ -3,6 +3,9 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Prepended onto Java's InternalSession: run, begin_transaction, the
7
+ # managed execute_read/write runners (reverse-checking the user block),
8
+ # and last_bookmarks as a Ruby Set.
6
9
  module InternalSession
7
10
  extend AutoCloseable
8
11
  include ConfigConverter
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Prepended onto Java's InternalTransaction: commit, rollback and run,
7
+ # each mapping Java exceptions to the driver's Ruby ones.
6
8
  module InternalTransaction
7
9
  include Internal::AbstractQueryRunner
8
10
  include CloseOverride
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Adapts a Ruby ::Logger to Java's org.neo4j.driver.Logging/Logger
7
+ # interface, so the Java driver logs through the user's Ruby logger.
6
8
  class Logger
7
9
  include org.neo4j.driver.Logger
8
10
  include org.neo4j.driver.Logging
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Mixed into Value-backed records and entities: exposes their map form
7
+ # as a Ruby Hash of native values.
6
8
  module MapConverter
7
9
  include PlainMapConverter
8
10
 
@@ -3,13 +3,16 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # The Ruby→native boundary: converts Ruby values (collections, temporals,
7
+ # Point, Duration, UUID, byte strings, symbols) into the Java driver
8
+ # types the wire layer accepts.
6
9
  module NeoConverter
7
10
  private
8
11
 
9
12
  def to_neo(object, skip_unknown: false)
10
13
  case object
11
14
  when Hash
12
- object.map { |key, value| [key.to_s, to_neo(value)] }.to_h
15
+ object.to_h { |key, value| [key.to_s, to_neo(value)] }
13
16
  when Types::Path
14
17
  Exceptions::ClientException.unable_to_convert(object)
15
18
  when Enumerable
@@ -32,7 +35,7 @@ module Neo4j
32
35
  Java::JavaTime::LocalDateTime.of_epoch_second(object.epoch_seconds, object.nanoseconds,
33
36
  Java::JavaTime::ZoneOffset::UTC)
34
37
  when defined?(ActiveSupport::TimeWithZone) && ActiveSupport::TimeWithZone
35
- to_zoned_date_time(object, object.time_zone.tzinfo.identifier)
38
+ to_zoned_date_time(object, Neo4j::Driver::Internal::ZoneIdentifier.call(object.time_zone))
36
39
  when Time, DateTime
37
40
  to_zoned_date_time(object, zone_identifier_for(object))
38
41
  when Date
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Mixed into java.util.Map: returns it as a Ruby Hash with symbol keys
7
+ # and recursively Ruby-ified values.
6
8
  module PlainMapConverter
7
9
  def as_ruby_object = to_h.transform_values!(&:as_ruby_object).transform_keys!(&:to_sym)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Prepended onto Java's Query: returns its parameters as a Ruby Hash of
7
+ # native values.
6
8
  module Query
7
9
  def parameters
8
10
  super.as_ruby_object
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # The native→Ruby boundary: converts a Java driver Value into the
7
+ # matching Ruby or Types object, dispatching on its type constructor.
6
8
  module RubyConverter
7
9
  include MapConverter
8
10
 
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Builds a Java Query from Cypher text and a validated Ruby parameters
7
+ # Hash; shared by the session/transaction run() overrides.
6
8
  module RunOverride
7
9
  include NeoConverter
8
10
 
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
+ # Exposes a path or segment's Java start()/end() as start_node/end_node
7
+ # (`end` being a Ruby keyword).
6
8
  module StartEndNaming
7
9
  def start_node
8
10
  java_send(:start)
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Internal
6
+ # No-op stand-in for an ActiveSupport-style deprecator; swallows the
7
+ # `behavior=` configuration the driver would otherwise forward.
6
8
  module Deprecator
7
9
  class << self
8
10
  def deprecator
@@ -3,6 +3,10 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Internal
6
+ # Converts a timeout from seconds (or ActiveSupport::Duration) to integer
7
+ # milliseconds, rejecting negatives. Used for the Bolt tx_timeout (MRI
8
+ # session) and, on JRuby, for the connection / routing-table and other
9
+ # config timeouts handed to the Java driver.
6
10
  module DurationNormalizer
7
11
  # Convert timeout from seconds (or ActiveSupport::Duration) to
8
12
  # milliseconds for the Bolt protocol. A negative timeout is
@@ -3,6 +3,8 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Internal
6
+ # Client-side argument checks (hash parameters, non-nil values, non-empty
7
+ # query text, credentials) mirroring the Java driver's own validation.
6
8
  module Validator
7
9
  def self.require_hash_parameters!(parameters)
8
10
  require_hash!(parameters) do
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Internal
6
+ # The IANA zone identifier for a TimeWithZone-like value's zone, for the
7
+ # Bolt DateTimeZoneId structure. Matches the Java driver, which sends
8
+ # ZonedDateTime#getZone#getId verbatim: a zone whose own name is already a
9
+ # valid IANA id is kept as-is — so "UTC" stays "UTC" rather than TZInfo's
10
+ # canonical "Etc/UTC" — while an ActiveSupport::TimeZone built from a Rails
11
+ # display name ("Mountain Time (US & Canada)"), which is not a valid id,
12
+ # falls back to its tzinfo identifier ("America/Denver"). Returns nil when
13
+ # the zone exposes no usable identifier (e.g. an offset-only zone), so the
14
+ # caller can fall back to the offset form.
15
+ module ZoneIdentifier
16
+ module_function
17
+
18
+ def call(zone)
19
+ name = zone.name if zone.respond_to?(:name)
20
+ return name if name && valid?(name)
21
+
22
+ zone.tzinfo.identifier if zone.respond_to?(:tzinfo)
23
+ end
24
+
25
+ def valid?(name)
26
+ TZInfo::Timezone.get(name)
27
+ true
28
+ rescue TZInfo::InvalidTimezoneIdentifier
29
+ false
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -60,7 +60,7 @@ module Neo4j
60
60
  # Normalize nanoseconds overflow/underflow into seconds:
61
61
  # -1ns becomes -1s + 999999999ns; 1.5e9 ns becomes 1s + 5e8 ns.
62
62
  def normalize!
63
- if @nanoseconds < 0
63
+ if @nanoseconds.negative?
64
64
  sec_adjust = (@nanoseconds.abs / NANOS_PER_SECOND.to_f).ceil
65
65
  @seconds -= sec_adjust
66
66
  @nanoseconds += sec_adjust * NANOS_PER_SECOND
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '6.2.1'
5
+ VERSION = '6.3.0'
6
6
  end
7
7
  end
data/lib/neo4j/driver.rb CHANGED
@@ -4,6 +4,8 @@ require 'neo4j-ruby-driver_jars'
4
4
  require 'neo4j-ruby-driver_loader'
5
5
 
6
6
  module Neo4j
7
+ # Top-level namespace for the JRuby flavour: imports the org.neo4j.driver
8
+ # Java packages and prepends the Ext mixins that adapt them to the Ruby API.
7
9
  module Driver
8
10
  Loader.load(:jruby) do |loader|
9
11
  impl_root = File.expand_path('..', __dir__)
@@ -18,19 +20,24 @@ module Neo4j
18
20
  Result = Java::OrgNeo4jDriverInternal::InternalResult
19
21
  Transaction = Java::OrgNeo4jDriverInternal::DelegatingTransactionContext
20
22
 
23
+ # Mirrors org.neo4j.driver.internal — Java internals the driver reaches
24
+ # into directly, such as DriverFactory and DatabaseName.
21
25
  module Internal
22
26
  java_import org.neo4j.driver.internal.shaded.bolt.connection.DatabaseName
23
27
  java_import org.neo4j.driver.internal.DriverFactory
24
28
 
29
+ # Mirrors org.neo4j.driver.internal.security — the auth-token manager internals.
25
30
  module Security
26
31
  java_import org.neo4j.driver.internal.security.StaticAuthTokenManager
27
32
  end
28
33
  end
29
34
 
35
+ # Mirrors org.neo4j.driver.net — public networking types (ServerAddress, resolver).
30
36
  module Net
31
37
  include_package 'org.neo4j.driver.net'
32
38
  end
33
39
 
40
+ # Mirrors org.neo4j.driver.summary — result-summary Java types (counters, notifications, plans).
34
41
  module Summary
35
42
  include_package 'org.neo4j.driver.summary'
36
43
  GqlNotification = Java::OrgNeo4jDriverInternalSummary::InternalGqlNotification
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is here so that there is a file with the same name as the gem that
2
4
  # can be required by Bundler.require. Applications should normally
3
5
  # require 'neo4j/driver'.
@@ -4,13 +4,13 @@
4
4
  begin
5
5
  require 'jar_dependencies'
6
6
  rescue LoadError
7
- require 'org/neo4j/driver/neo4j-java-driver-all/6.2.1/neo4j-java-driver-all-6.2.1.jar'
7
+ require 'org/neo4j/driver/neo4j-java-driver-all/6.3.0/neo4j-java-driver-all-6.3.0.jar'
8
8
  require 'org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar'
9
- require 'org/neo4j/driver/neo4j-java-driver-observation-metrics/6.2.1/neo4j-java-driver-observation-metrics-6.2.1.jar'
9
+ require 'org/neo4j/driver/neo4j-java-driver-observation-metrics/6.3.0/neo4j-java-driver-observation-metrics-6.3.0.jar'
10
10
  end
11
11
 
12
12
  if defined? Jars
13
- require_jar 'org.neo4j.driver', 'neo4j-java-driver-all', '6.2.1'
13
+ require_jar 'org.neo4j.driver', 'neo4j-java-driver-all', '6.3.0'
14
14
  require_jar 'org.reactivestreams', 'reactive-streams', '1.0.4'
15
- require_jar 'org.neo4j.driver', 'neo4j-java-driver-observation-metrics', '6.2.1'
15
+ require_jar 'org.neo4j.driver', 'neo4j-java-driver-observation-metrics', '6.3.0'
16
16
  end
@@ -8,6 +8,8 @@ require 'zeitwerk'
8
8
 
9
9
  module Neo4j
10
10
  module Driver
11
+ # Boots the driver for a given flavour (:mri or :jruby): configures the
12
+ # Zeitwerk loader over the shared and impl roots, then eager-loads them.
11
13
  class Loader
12
14
  class << self
13
15
  # `__dir__` resolves to:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is for backwards compatibility only.
2
4
  # Applications should require 'neo4j/driver'.
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-ruby-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.1
4
+ version: 6.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - Neo4j Driver Team
@@ -142,6 +142,7 @@ files:
142
142
  - lib/neo4j/driver/internal/duration_normalizer.rb
143
143
  - lib/neo4j/driver/internal/internal_auth_token_manager.rb
144
144
  - lib/neo4j/driver/internal/validator.rb
145
+ - lib/neo4j/driver/internal/zone_identifier.rb
145
146
  - lib/neo4j/driver/summary/query_type.rb
146
147
  - lib/neo4j/driver/types/duration.rb
147
148
  - lib/neo4j/driver/types/local_date_time.rb
@@ -152,8 +153,8 @@ files:
152
153
  - lib/neo4j/driver/types/unresolvable_zoned_date_time.rb
153
154
  - lib/neo4j/driver/version.rb
154
155
  - lib/neo4j_ruby_driver.rb
155
- - lib/org/neo4j/driver/neo4j-java-driver-all/6.2.1/neo4j-java-driver-all-6.2.1.jar
156
- - lib/org/neo4j/driver/neo4j-java-driver-observation-metrics/6.2.1/neo4j-java-driver-observation-metrics-6.2.1.jar
156
+ - lib/org/neo4j/driver/neo4j-java-driver-all/6.3.0/neo4j-java-driver-all-6.3.0.jar
157
+ - lib/org/neo4j/driver/neo4j-java-driver-observation-metrics/6.3.0/neo4j-java-driver-observation-metrics-6.3.0.jar
157
158
  - lib/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar
158
159
  homepage: https://github.com/neo4jrb/neo4j-ruby-driver
159
160
  licenses:
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
175
  - !ruby/object:Gem::Version
175
176
  version: '0'
176
177
  requirements: []
177
- rubygems_version: 4.0.3
178
+ rubygems_version: 4.0.21
178
179
  specification_version: 4
179
180
  summary: Clean Neo4j Bolt driver implementation for Ruby
180
181
  test_files: []