neo4j-ruby-driver 5.19.0.alpha.0-java → 6.0.1.alpha.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1aa7fcad46f560b3d46dcae20f6d424c62862c6f3bda9c54b0dfe297ef1f070e
4
- data.tar.gz: 1803639d3833f424b6706a22aa2529c3e7579b8d006c7294d20b13145833f2b2
3
+ metadata.gz: c174b6fb71a96ae78be2e140cdeb0918dac5e1afb5036a82abb067985c815ac2
4
+ data.tar.gz: efd9b59b2de7bc38291332ebb5eedc1af1cebb0521835e9a6735267c88ae1813
5
5
  SHA512:
6
- metadata.gz: 74461831e523cf1136c9b0b84f57a8946bdba2de16f2bb79d9126d7c28a8246db936f1c7a5d9f1ac067c5426680124997fb414f8fb0bb4278880508ffa5d67cd
7
- data.tar.gz: 817d49fa0e8f3421b3e5c75eb1893a7c8262f2022f15878fdb8168f5798600cb4e2d1d2c2604f2f38c1a10e02e32c592e8c774fe6f8d6bfc7a7436e233429fb6
6
+ metadata.gz: b5e75ea8218be1484361218a5d0300c8b9e71843bb78956cd831810c60380b9a701c63e091837e7c097ba312ba20a491d422ec830eee41e51cdb0e315760f378
7
+ data.tar.gz: dd15c10c93e58fce166e76a4d5820626f27edc74ff7722b0c7cfec18d84db5b1d3fe1bf8910c7e902d4b03c77ea859c6844537c30fc309d81c1e311e0e88e593
data/README.md CHANGED
@@ -1,12 +1,50 @@
1
- # Neo4j::Driver
1
+ # Neo4j Ruby Driver
2
2
 
3
- home :: https://github.com/neo4jrb/neo4j-ruby-driver
3
+ This repository contains 2 implementation of a Neo4j driver for Ruby:
4
4
 
5
- This repository contains 2 implementation of a neo4j driver for ruby:
6
- - based on official java implementation. It provides a thin wrapper over the java driver (only on jruby).
7
- - pure ruby implmementation. Available on all ruby versions >= 3.1.
5
+ - based on official Java implementation. It provides a thin wrapper over the Java driver (only on jruby).
6
+ - pure Ruby implementation. Available on all Ruby versions >= 3.1.
8
7
 
9
- ## Installation
8
+ Network communication is handled using [Bolt Protocol](https://7687.org/).
9
+
10
+ <details>
11
+ <summary>Table of Contents</summary>
12
+
13
+ * [Getting started](#getting-started)
14
+ * [Installation](#installation)
15
+ * [Getting a Neo4j instance](#getting-a-neo4j-instance)
16
+ * [Quick start example](#quick-start-example)
17
+ * [Server Compatibility](#server-compatibility)
18
+ * [Usage](#usage)
19
+ * [Connecting to a database](#connecting-to-a-database)
20
+ * [URI schemes](#uri-schemes)
21
+ * [Authentication](#authentication)
22
+ * [Configuration](#configuration)
23
+ * [Connectivity check](#connectivity-check)
24
+ * [Sessions & transactions](#sessions--transactions)
25
+ * [Session](#session)
26
+ * [Auto-commit transactions](#auto-commit-transactions)
27
+ * [Explicit transactions](#explicit-transactions)
28
+ * [Read transactions](#read-transactions)
29
+ * [Write transactions](#write-transactions)
30
+ * [Working with results](#working-with-results)
31
+ * [Accessing Node and Relationship data](#accessing-node-and-relationship-data)
32
+ * [Working with Paths](#working-with-paths)
33
+ * [Working with temporal types](#working-with-temporal-types)
34
+ * [Type mapping](#type-mapping)
35
+ * [Advanced](#advanced)
36
+ * [Connection pooling](#connection-pooling)
37
+ * [Logging](#logging)
38
+ * [For Driver Engineers](#for-driver-engineers)
39
+ * [Testing](#testing)
40
+ * [Contributing](#contributing)
41
+ * [License](#license)
42
+
43
+ </details>
44
+
45
+ ## Getting started
46
+
47
+ ### Installation
10
48
 
11
49
  Add this line to your application's Gemfile:
12
50
 
@@ -16,68 +54,430 @@ gem 'neo4j-ruby-driver'
16
54
 
17
55
  And then execute:
18
56
 
19
- $ bundle
57
+ ```bash
58
+ bundle install
59
+ ```
20
60
 
21
61
  Or install it yourself as:
22
62
 
23
- $ gem install neo4j-ruby-driver
63
+ ```bash
64
+ gem install neo4j-ruby-driver
65
+ ```
66
+
67
+ ### Getting a Neo4j instance
68
+
69
+ You need a running Neo4j database in order to use the driver with it. The easiest way to spin up a **local instance** is
70
+ through a Docker container.
71
+
72
+ The command below runs the latest Neo4j version in Docker, setting the admin username and password to `neo4j` and
73
+ `password` respectively:
74
+
75
+ ```bash
76
+ docker run \
77
+ -p7474:7474 \
78
+ -p7687:7687 \
79
+ -d \
80
+ -e NEO4J_AUTH=neo4j/password \
81
+ neo4j:latest
82
+ ```
83
+
84
+ ### Quick start example
85
+
86
+ ```ruby
87
+ require 'neo4j/driver'
88
+
89
+ Neo4j::Driver::GraphDatabase.driver(
90
+ 'bolt://localhost:7687',
91
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
92
+ ) do |driver|
93
+ driver.session(database: 'neo4j') do |session|
94
+ query_result = session.run('RETURN 2+2 AS value')
95
+ puts "2+2 equals #{query_result.single['value']}"
96
+
97
+ # consume gives the execution summary
98
+ create_result = session.run('CREATE (n)').consume
99
+ puts "Nodes created: #{create_result.counters.nodes_created}"
100
+ end
101
+ end
102
+ ```
24
103
 
25
104
  ## Server Compatibility
26
105
 
27
- The compatibility with Neo4j Server versions is documented in the [Neo4j Knowledge Base](https://neo4j.com/developer/kb/neo4j-supported-versions/).
106
+ The compatibility with Neo4j Server versions is documented in
107
+ the [Neo4j Knowledge Base](https://neo4j.com/developer/kb/neo4j-supported-versions/).
28
108
 
29
109
  ## Usage
30
110
 
31
- The API is to highest possible degree consistent with the official java driver.
32
- At this moment [The Neo4j Drivers Manual v4.4](https://neo4j.com/docs/java-manual/current/) along with the ruby version of the [code fragments](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb) and the ruby specs provide the only documentation.
111
+ The API is to highest possible degree consistent with the official Java driver. Please refer to
112
+ the [Neo4j Java Driver Manual](https://neo4j.com/docs/java-manual/current/), [examples in Ruby](https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb),
113
+ and code snippets below to understand how to use it.
114
+ [Neo4j Java Driver API Docs](https://neo4j.com/docs/api/java-driver/current/) can be helpful as well.
115
+
116
+ ### Connecting to a database
117
+
118
+ #### URI schemes
119
+
120
+ The driver supports the following URI schemes:
121
+
122
+ | URI Scheme | Description |
123
+ |----------------|---------------------------------------------------------------------------------|
124
+ | `neo4j://` | Connect using routing to a cluster/causal cluster. |
125
+ | `neo4j+s://` | Same as `neo4j://` but with full TLS encryption. |
126
+ | `neo4j+ssc://` | Same as `neo4j://` but with full TLS encryption, without hostname verification. |
127
+ | `bolt://` | Connect directly to a server using the Bolt protocol. |
128
+ | `bolt+s://` | Same as `bolt://` but with full TLS encryption. |
129
+ | `bolt+ssc://` | Same as `bolt://` but with full TLS encryption, without hostname verification. |
130
+
131
+ Example:
132
+
133
+ ```ruby
134
+ # Connect to a single instance
135
+ driver = Neo4j::Driver::GraphDatabase.driver(
136
+ 'bolt://localhost:7687',
137
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
138
+ )
139
+
140
+ # Connect to a cluster
141
+ driver = Neo4j::Driver::GraphDatabase.driver(
142
+ 'neo4j://graph.example.com:7687',
143
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
144
+ )
145
+ ```
146
+
147
+ #### Authentication
148
+
149
+ The driver provides multiple authentication methods:
150
+
151
+ ```ruby
152
+ # Basic authentication
153
+ auth = Neo4j::Driver::AuthTokens.basic('neo4j', 'password')
154
+
155
+ # With realm specification
156
+ auth = Neo4j::Driver::AuthTokens.basic('neo4j', 'password', 'realm')
157
+
158
+ # Kerberos authentication
159
+ auth = Neo4j::Driver::AuthTokens.kerberos('ticket')
160
+
161
+ # Bearer authentication
162
+ auth = Neo4j::Driver::AuthTokens.bearer('token')
163
+
164
+ # Custom authentication
165
+ auth = Neo4j::Driver::AuthTokens.custom('principal', 'credentials', 'realm', 'scheme')
166
+
167
+ # No authentication
168
+ auth = Neo4j::Driver::AuthTokens.none
169
+ ```
170
+
171
+ #### Configuration
172
+
173
+ You can configure the driver with additional options:
174
+
175
+ ```ruby
176
+ config = {
177
+ connection_timeout: 15.seconds,
178
+ connection_acquisition_timeout: 1.minute,
179
+ max_transaction_retry_time: 30.seconds,
180
+ encryption: true,
181
+ trust_strategy: :trust_all_certificates
182
+ }
183
+
184
+ driver = Neo4j::Driver::GraphDatabase.driver(
185
+ 'neo4j://localhost:7687',
186
+ Neo4j::Driver::AuthTokens.basic('neo4j', 'password'),
187
+ **config
188
+ )
189
+ ```
190
+
191
+ #### Connectivity check
192
+
193
+ ```ruby
194
+ if driver.verify_connectivity
195
+ puts "Driver is connected to the database"
196
+ else
197
+ puts "Driver cannot connect to the database"
198
+ end
199
+ ```
200
+
201
+ ### Sessions & transactions
202
+
203
+ The driver provides sessions to interact with the database and to execute queries.
204
+
205
+ #### Session
206
+
207
+ Sessions are lightweight and disposable database connections. Always close your sessions when done:
208
+
209
+ ```ruby
210
+ session = driver.session(database: 'neo4j')
211
+ begin
212
+ session.run('MATCH (n) RETURN n LIMIT 10')
213
+ ensure
214
+ session.close
215
+ end
216
+ ```
217
+
218
+ Or use a block that automatically closes the session:
219
+
220
+ ```ruby
221
+ driver.session(database: 'neo4j') do |session|
222
+ session.run('MATCH (n) RETURN n LIMIT 10')
223
+ end
224
+ ```
225
+
226
+ Session options:
227
+
228
+ ```ruby
229
+ # Default database
230
+ session = driver.session
231
+
232
+ # Specific database
233
+ session = driver.session(database: 'neo4j')
234
+
235
+ # With access mode
236
+ session = driver.session(database: 'neo4j', default_access_mode: Neo4j::Driver::AccessMode::READ)
237
+
238
+ # With bookmarks for causal consistency
239
+ session = driver.session(
240
+ database: 'neo4j',
241
+ bookmarks: [Neo4j::Driver::Bookmark.from('bookmark-1')]
242
+ )
243
+ ```
244
+
245
+ #### Auto-commit transactions
246
+
247
+ For simple, one-off queries, use auto-commit transactions:
248
+
249
+ ```ruby
250
+ session.run('CREATE (n:Person {name: $name})', name: 'Alice')
251
+ ```
252
+
253
+ #### Explicit transactions
254
+
255
+ For multiple queries that need to be executed as a unit, use explicit transactions:
256
+
257
+ ```ruby
258
+ tx = session.begin_transaction
259
+ begin
260
+ tx.run('CREATE (n:Person {name: $name})', name: 'Alice')
261
+ tx.run('CREATE (n:Person {name: $name})', name: 'Bob')
262
+ tx.commit
263
+ rescue
264
+ tx.rollback
265
+ raise
266
+ end
267
+ ```
268
+
269
+ #### Read transactions
270
+
271
+ Specifically for read operations:
272
+
273
+ ```ruby
274
+ result = session.read_transaction do |tx|
275
+ tx.run('MATCH (n:Person) RETURN n.name').map { |record| record['n.name'] }
276
+ end
277
+ puts result
278
+ ```
279
+
280
+ #### Write transactions
281
+
282
+ Specifically for write operations:
283
+
284
+ ```ruby
285
+ session.write_transaction do |tx|
286
+ tx.run('CREATE (n:Person {name: $name})', name: 'Charlie')
287
+ end
288
+ ```
289
+
290
+ ### Working with results
291
+
292
+ ```ruby
293
+ result = session.run('MATCH (n:Person) RETURN n.name AS name, n.age AS age')
294
+
295
+ # Process results
296
+ result.each do |record|
297
+ puts "#{record['name']} is #{record['age']} years old"
298
+ end
299
+
300
+ # Check if there are more results
301
+ puts "Has more results: #{result.has_next?}"
302
+
303
+ # Get a single record
304
+ single = result.single
305
+ puts single['name'] if single
306
+
307
+ # Get keys available in the result
308
+ puts "Keys: #{result.keys}"
309
+
310
+ # Access by field index
311
+ result.each do |record|
312
+ puts "First field: #{record[0]}"
313
+ end
314
+
315
+ # Convert to array
316
+ records = result.to_a
317
+ ```
318
+
319
+ #### Accessing Node and Relationship data
320
+
321
+ Working with graph entities:
322
+
323
+ ```ruby
324
+ result = session.run('MATCH (p:Person)-[r:KNOWS]->(friend) RETURN p, r, friend')
325
+
326
+ result.each do |record|
327
+ # Working with nodes
328
+ person = record['p']
329
+ puts "Node ID: #{person.id}"
330
+ puts "Labels: #{person.labels.join(', ')}"
331
+ puts "Properties: #{person.properties}"
332
+ puts "Name property: #{person.properties['name']}"
333
+
334
+ # Working with relationships
335
+ relationship = record['r']
336
+ puts "Relationship ID: #{relationship.id}"
337
+ puts "Type: #{relationship.type}"
338
+ puts "Properties: #{relationship.properties}"
339
+
340
+ # Start and end nodes of the relationship
341
+ puts "Relationship: #{relationship.start_node_id} -> #{relationship.end_node_id}"
342
+ end
343
+ ```
344
+
345
+ #### Working with Paths
346
+
347
+ Processing paths returned from Cypher:
348
+
349
+ ```ruby
350
+ result = session.run('MATCH p = (:Person)-[:KNOWS*]->(:Person) RETURN p')
351
+
352
+ result.each do |record|
353
+ path = record['p']
354
+
355
+ # Get all nodes in the path
356
+ nodes = path.nodes
357
+ puts "Nodes in path: #{nodes.map { |n| n.properties['name'] }.join(' -> ')}"
358
+
359
+ # Get all relationships in the path
360
+ relationships = path.relationships
361
+ puts "Relationship types: #{relationships.map(&:type).join(', ')}"
362
+
363
+ # Iterate through the path segments
364
+ path.each do |segment|
365
+ puts "#{segment.start_node.properties['name']} -[#{segment.relationship.type}]-> #{segment.end_node.properties['name']}"
366
+ end
367
+ end
368
+ ```
369
+
370
+ #### Working with temporal types
371
+
372
+ Creating a node with properties of temporal types:
373
+
374
+ ```ruby
375
+ session.run(
376
+ 'CREATE (e:Event {datetime: $datetime, duration: $duration})',
377
+ datetime: DateTime.new(2025, 5, 5, 5, 55, 55), duration: 1.hour
378
+ )
379
+ ```
380
+
381
+ Querying temporal values:
382
+
383
+ ```ruby
384
+ session.run('MATCH (e:Event) LIMIT 1 RETURN e.datetime, e.duration').single.to_h
385
+ # => {"e.datetime": 2025-05-05 05:55:55 +0000, "e.duration": 3600 seconds}
386
+ ```
387
+
388
+ ### Type mapping
33
389
 
34
- [Neo4j Java Driver 4.3 API](https://neo4j.com/docs/api/java-driver/current/) can be helpful as well..
390
+ The Neo4j Ruby Driver maps Cypher types to Ruby types:
35
391
 
36
- ## Development
392
+ | Cypher Type | Ruby Type |
393
+ |----------------|-----------------------------------------------|
394
+ | null | nil |
395
+ | List | Enumerable |
396
+ | Map | Hash (symbolized keys) |
397
+ | Boolean | TrueClass/FalseClass |
398
+ | Integer | Integer/String[^1] |
399
+ | Float | Float |
400
+ | String | String/Symbol[^2] (encoding: UTF-8) |
401
+ | ByteArray | String (encoding: BINARY) |
402
+ | Date | Date |
403
+ | Zoned Time | Neo4j::Driver::Types::OffsetTime |
404
+ | Local Time | Neo4j::Driver::Types::LocalTime |
405
+ | Zoned DateTime | Time/ActiveSupport::TimeWithZone/DateTime[^3] |
406
+ | Local DateTime | Neo4j::Driver::Types::LocalDateTime |
407
+ | Duration | ActiveSupport::Duration |
408
+ | Point | Neo4j::Driver::Types::Point |
409
+ | Node | Neo4j::Driver::Types::Node |
410
+ | Relationship | Neo4j::Driver::Types::Relationship |
411
+ | Path | Neo4j::Driver::Types::Path |
37
412
 
38
- This gem includes 2 different implementations: java driver wrapper and pure ruby driver
413
+ [^1]: An Integer smaller than -2 ** 63 or larger than 2 ** 63 will always be implicitly converted to String
414
+ [^2]: A Symbol passed as a parameter will always be implicitly converted to String. All Strings other than BINARY
415
+ encoded are converted to UTF-8 when stored in Neo4j
416
+ [^3]: A Ruby DateTime passed as a parameter will always be implicitly converted to Time
39
417
 
40
- $ bin/setup
41
-
42
- ## Testing
418
+ ### Advanced
43
419
 
44
- To run the tests the following tools need to be installed:
420
+ #### Connection pooling
45
421
 
46
- $ brew install python
47
- $ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
48
- $ neoctrl-install -e 4.4.5 servers
49
- $ neoctrl-configure servers/neo4j-enterprise-4.4.5 dbms.directories.import= dbms.default_listen_address=::
50
- $ neoctrl-set-initial-password pass servers/neo4j-enterprise-4.4.5
51
- $ neoctrl-start servers/neo4j-enterprise-4.4.5
422
+ The driver handles connection pooling automatically. Configure the connection pool:
423
+
424
+ ```ruby
425
+ config = {
426
+ max_connection_pool_size: 100,
427
+ max_connection_lifetime: 1.hour
428
+ }
52
429
 
53
- To run the tests:
54
- ```console
55
- $ bin/setup
56
- $ rspec spec
430
+ driver = Neo4j::Driver::GraphDatabase.driver('neo4j://localhost:7687', auth, **config)
57
431
  ```
58
432
 
59
- Known errors:
433
+ #### Logging
60
434
 
61
- 1. In case of heap space memory error (`org.neo4j.driver.exceptions.DatabaseException: Java heap space`), you should limit the dbms memory, for example:
435
+ Configure logging for the driver:
62
436
 
63
- ```console
64
- $ neoctrl-configure servers/neo4j-enterprise-4.4.5 dbms.memory.pagecache.size=600m dbms.memory.heap.max_size=600m dbms.memory.heap.initial_size=600m dbms.directories.import= dbms.connectors.default_listen_address=::
437
+ ```ruby
438
+ config = {
439
+ logger: Logger.new(STDOUT).tap { |log| log.level = Logger::DEBUG }
440
+ }
441
+
442
+ driver = Neo4j::Driver::GraphDatabase.driver('neo4j://localhost:7687', auth, **config)
65
443
  ```
66
444
 
67
- 2. When using command `pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit`, if you have m1 mac chip, you may get error when pip3 tries to install `cryptography`. Steps to take in that case (reference https://stackoverflow.com/a/70074869/2559490)
445
+ ## For Driver Engineers
68
446
 
69
- ```console
70
- $ pip uninstall cffi
71
- $ python -m pip install --upgrade pip
72
- $ pip install cffi
73
- $ pip install cryptography
447
+ This gem includes 2 different implementations: a Java driver wrapper and a pure Ruby driver, so you will have to run
448
+ this command every time you switch the Ruby engine:
449
+
450
+ ```bash
451
+ bin/setup
74
452
  ```
75
453
 
454
+ ### Testing
455
+
456
+ There are two sets of tests for the driver. To run the specs placed in this repository, use a normal rspec command:
457
+
458
+ ```bash
459
+ rspec spec
460
+ ```
461
+
462
+ To run the [Testkit](https://github.com/neo4j-drivers/testkit) that is used to test all Neo4j driver implementations,
463
+ use the following:
464
+
465
+ ```bash
466
+ git clone git@github.com:neo4j-drivers/testkit.git
467
+ cd testkit
468
+ export TEST_DRIVER_NAME=ruby
469
+ export TEST_DRIVER_REPO=`realpath ../neo4j-ruby-driver`
470
+ export TEST_NEO4J_PASS=password
471
+ python3 main.py --tests UNIT_TESTS --configs 4.3-enterprise
472
+ ```
473
+
474
+ Please refer to the [Testkit](https://github.com/neo4j-drivers/testkit) documentation to learn more about its features.
475
+
76
476
  ## Contributing
77
477
 
78
- Suggestions, improvements, bug reports and pull requests are welcome on GitHub at https://github.com/neo4jrb/neo4j-ruby-driver.
478
+ Suggestions, improvements, bug reports and pull requests are welcome on GitHub
479
+ at https://github.com/neo4jrb/neo4j-ruby-driver.
79
480
 
80
481
  ## License
81
482
 
82
483
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
83
-
@@ -68,14 +68,14 @@ module Neo4j
68
68
 
69
69
  def notification_config(minimum_severity: nil, disabled_categories: nil)
70
70
  org.neo4j.driver.internal.InternalNotificationConfig.new(
71
- value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity),
71
+ value_of(org.neo4j.driver.internal.InternalNotificationSeverity, minimum_severity).or_else(nil),
72
72
  disabled_categories
73
- &.map { |value| value_of(org.neo4j.driver.internal.InternalNotificationCategory, value) }
73
+ &.map { |value| value_of(org.neo4j.driver.NotificationClassification, value) }
74
74
  &.then(&java.util.HashSet.method(:new)))
75
75
  end
76
76
 
77
77
  def value_of(klass, value)
78
- klass.value_of(value&.to_s&.upcase).or_else(nil)
78
+ klass.value_of(value&.to_s&.upcase)
79
79
  end
80
80
  end
81
81
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module DelegatingTransactionContext
7
+ include ExceptionCheckable
8
+ include RunOverride
9
+
10
+ def run(statement, **parameters)
11
+ check { super(to_statement(statement, parameters)) }
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -4,11 +4,11 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module GraphDatabase
7
- extend AutoClosable
7
+ extend AutoCloseable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
10
 
11
- auto_closable :driver
11
+ auto_closeable :driver
12
12
 
13
13
  def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, **config)
14
14
  check do
@@ -5,7 +5,7 @@ module Neo4j::Driver::Ext
5
5
  module Cluster
6
6
  module RoutingTableRegistryImpl
7
7
  def routing_table_handler(database)
8
- get_routing_table_handler(org.neo4j.driver.internal.DatabaseNameUtil.database(database)).then do |it|
8
+ get_routing_table_handler(org.neo4j.driver.internal.bolt.api.DatabaseName.database(database)).then do |it|
9
9
  it.get if it.present?
10
10
  end
11
11
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module Internal
7
+ module EagerResultValue
8
+ include InternalKeys
9
+
10
+ def records
11
+ super.to_a
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -4,12 +4,22 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module InternalDriver
7
- extend AutoClosable
7
+ extend AutoCloseable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
10
  include AsyncConverter
11
11
 
12
- auto_closable :session
12
+ auto_closeable :session
13
+
14
+ def execute_query(query, auth_token = nil, config = {}, **parameters)
15
+ check do
16
+ executable_query(query)
17
+ .with_auth_token(auth_token)
18
+ .with_config(to_java_config(Neo4j::Driver::QueryConfig, **config))
19
+ .with_parameters(to_neo(parameters))
20
+ .execute
21
+ end
22
+ end
13
23
 
14
24
  def session(**session_config)
15
25
  java_method(:session, [org.neo4j.driver.SessionConfig])
@@ -4,18 +4,18 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module InternalSession
7
- extend AutoClosable
7
+ extend AutoCloseable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
10
  include RunOverride
11
11
 
12
- auto_closable :begin_transaction
12
+ auto_closeable :begin_transaction
13
13
 
14
14
  # work around jruby issue https://github.com/jruby/jruby/issues/5603
15
15
  Struct.new('Wrapper', :object)
16
16
 
17
- %i[read write].each do |prefix|
18
- define_method("#{prefix}_transaction") do |**config, &block|
17
+ %i[read write].each do |mode|
18
+ define_method("execute_#{mode}") do |**config, &block|
19
19
  check do
20
20
  super(->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) }, to_java_config(Neo4j::Driver::TransactionConfig, **config)).object
21
21
  end
@@ -34,6 +34,10 @@ module Neo4j
34
34
  def begin_transaction(**config)
35
35
  check { super(to_java_config(Neo4j::Driver::TransactionConfig, **config)) }
36
36
  end
37
+
38
+ def last_bookmarks
39
+ super.to_set
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '5.19.0.alpha.0'
5
+ VERSION = '6.0.1.alpha.0'
6
6
  end
7
7
  end
@@ -10,12 +10,13 @@ module Neo4j
10
10
 
11
11
  include_package 'org.neo4j.driver'
12
12
 
13
+ EagerResult = Java::OrgNeo4jDriverInternal::EagerResultValue
13
14
  Record = Java::OrgNeo4jDriverInternal::InternalRecord
14
15
  Result = Java::OrgNeo4jDriverInternal::InternalResult
15
16
  Transaction = Java::OrgNeo4jDriverInternal::InternalTransaction
16
17
 
17
18
  module Internal
18
- java_import org.neo4j.driver.internal.DatabaseNameUtil
19
+ java_import org.neo4j.driver.internal.shaded.bolt.connection.DatabaseName
19
20
  end
20
21
 
21
22
  module Net
@@ -36,15 +37,13 @@ module Neo4j
36
37
  end
37
38
 
38
39
  Java::OrgNeo4jDriver::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
39
- Java::OrgNeo4jDriver::Bookmark.singleton_class.prepend Neo4j::Driver::Ext::Bookmark::ClassMethods
40
40
  Java::OrgNeo4jDriver::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
41
41
  Java::OrgNeo4jDriver::Query.prepend Neo4j::Driver::Ext::Query
42
- Java::OrgNeo4jDriverInternal::InternalBookmark.prepend Neo4j::Driver::Ext::Internal::InternalBookmark
42
+ Java::OrgNeo4jDriverInternal::EagerResultValue.prepend Neo4j::Driver::Ext::Internal::EagerResultValue
43
43
  Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
44
44
  Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
45
45
  Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
46
- Java::OrgNeo4jDriverInternal::InternalNotificationCategory.prepend Neo4j::Driver::Ext::Internal::InternalNotificationCommon
47
- Java::OrgNeo4jDriverInternal::InternalNotificationSeverity.prepend Neo4j::Driver::Ext::Internal::InternalNotificationCommon
46
+ Java::OrgNeo4jDriverInternal::InternalNotificationSeverity.delegate :name, to: :type
48
47
  Java::OrgNeo4jDriverInternal::InternalPath.include Neo4j::Driver::Ext::StartEndNaming
49
48
  Java::OrgNeo4jDriverInternal::InternalPath::SelfContainedSegment.include Neo4j::Driver::Ext::StartEndNaming
50
49
  Java::OrgNeo4jDriverInternal::InternalRecord.prepend Neo4j::Driver::Ext::InternalRecord
@@ -52,10 +51,11 @@ Java::OrgNeo4jDriverInternal::InternalRelationship.prepend Neo4j::Driver::Ext::I
52
51
  Java::OrgNeo4jDriverInternal::InternalResult.prepend Neo4j::Driver::Ext::InternalResult
53
52
  Java::OrgNeo4jDriverInternal::InternalSession.prepend Neo4j::Driver::Ext::InternalSession
54
53
  Java::OrgNeo4jDriverInternal::InternalTransaction.prepend Neo4j::Driver::Ext::InternalTransaction
54
+ Java::OrgNeo4jDriverInternal::DelegatingTransactionContext.prepend Neo4j::Driver::Ext::DelegatingTransactionContext
55
55
  Java::OrgNeo4jDriverInternalAsync::InternalAsyncSession.prepend Neo4j::Driver::Ext::Internal::Async::InternalAsyncSession
56
- Java::OrgNeo4jDriverInternalCluster::RoutingTableRegistryImpl.include Neo4j::Driver::Ext::Internal::Cluster::RoutingTableRegistryImpl
57
- Java::OrgNeo4jDriverInternalCursor::DisposableAsyncResultCursor.prepend Neo4j::Driver::Ext::Internal::Cursor::DisposableAsyncResultCursor
58
- Java::OrgNeo4jDriverInternalMetrics::InternalConnectionPoolMetrics.include Neo4j::Driver::Ext::Internal::Metrics::InternalConnectionPoolMetrics
56
+ Java::OrgNeo4jDriverInternalShadedBoltConnectionRoutedImplCluster::RoutingTableRegistryImpl.include Neo4j::Driver::Ext::Internal::Cluster::RoutingTableRegistryImpl
57
+ # Java::OrgNeo4jDriverInternalCursor::DisposableAsyncResultCursor.prepend Neo4j::Driver::Ext::Internal::Cursor::DisposableAsyncResultCursor
58
+ Java::OrgNeo4jDriverObservationMetricsInternal::InternalConnectionPoolMetrics.include Neo4j::Driver::Ext::Internal::Metrics::InternalConnectionPoolMetrics
59
59
  Java::OrgNeo4jDriverInternalSummary::InternalNotification.prepend Neo4j::Driver::Ext::Internal::Summary::InternalNotification
60
60
  Java::OrgNeo4jDriverInternalSummary::InternalPlan.prepend Neo4j::Driver::Ext::Internal::Summary::InternalPlan
61
61
  Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- module AutoClosable
6
- def auto_closable(*methods)
5
+ module AutoCloseable
6
+ def auto_closeable(*methods)
7
7
  prepend with_block_definer(methods)
8
8
  end
9
9
 
@@ -13,15 +13,15 @@ module Neo4j
13
13
  Module.new do
14
14
  methods.each do |method|
15
15
  define_method(method) do |*args, **kwargs, &block|
16
- closable = super(*args, **kwargs)
16
+ closeable = super(*args, **kwargs)
17
17
  if block
18
18
  begin
19
- block.arity.zero? ? closable.instance_eval(&block) : block.call(closable)
19
+ block.arity.zero? ? closeable.instance_eval(&block) : block.call(closeable)
20
20
  ensure
21
- closable&.close
21
+ closeable&.close
22
22
  end
23
23
  else
24
- closable
24
+ closeable
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,15 @@
1
+ module Neo4j
2
+ module Driver
3
+ module Internal
4
+ module Deprecator
5
+ def self.deprecator
6
+ @deprecator ||= ActiveSupport::Deprecation.new('6.0', 'neo4j-ruby-driver')
7
+ end
8
+
9
+ def self.log_warning(old_method, new_method, version)
10
+ deprecator.deprecation_warning(old_method, new_method)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,36 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-ruby-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.19.0.alpha.0
4
+ version: 6.0.1.alpha.0
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-04-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
13
+ name: activesupport
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
19
- name: activesupport
18
+ version: '7.1'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '0'
25
+ version: '7.1'
27
26
  - !ruby/object:Gem::Dependency
27
+ name: csv
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 2.1.10
32
+ version: '3.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - !ruby/object:Gem::Dependency
33
41
  name: zeitwerk
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.1.10
34
47
  type: :runtime
35
48
  prerelease: false
36
49
  version_requirements: !ruby/object:Gem::Requirement
@@ -39,12 +52,12 @@ dependencies:
39
52
  - !ruby/object:Gem::Version
40
53
  version: 2.1.10
41
54
  - !ruby/object:Gem::Dependency
55
+ name: concurrent-ruby-edge
42
56
  requirement: !ruby/object:Gem::Requirement
43
57
  requirements:
44
58
  - - ">="
45
59
  - !ruby/object:Gem::Version
46
60
  version: 0.6.0
47
- name: concurrent-ruby-edge
48
61
  type: :runtime
49
62
  prerelease: false
50
63
  version_requirements: !ruby/object:Gem::Requirement
@@ -53,26 +66,26 @@ dependencies:
53
66
  - !ruby/object:Gem::Version
54
67
  version: 0.6.0
55
68
  - !ruby/object:Gem::Dependency
69
+ name: jar-dependencies
56
70
  requirement: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - ">="
59
73
  - !ruby/object:Gem::Version
60
- version: 0.4.1
61
- name: jar-dependencies
74
+ version: 0.5.5
62
75
  type: :runtime
63
76
  prerelease: false
64
77
  version_requirements: !ruby/object:Gem::Requirement
65
78
  requirements:
66
79
  - - ">="
67
80
  - !ruby/object:Gem::Version
68
- version: 0.4.1
81
+ version: 0.5.5
69
82
  - !ruby/object:Gem::Dependency
83
+ name: ffaker
70
84
  requirement: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - ">="
73
87
  - !ruby/object:Gem::Version
74
88
  version: '0'
75
- name: ffaker
76
89
  type: :development
77
90
  prerelease: false
78
91
  version_requirements: !ruby/object:Gem::Requirement
@@ -81,12 +94,12 @@ dependencies:
81
94
  - !ruby/object:Gem::Version
82
95
  version: '0'
83
96
  - !ruby/object:Gem::Dependency
97
+ name: hoe
84
98
  requirement: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - ">="
87
101
  - !ruby/object:Gem::Version
88
102
  version: '0'
89
- name: hoe
90
103
  type: :development
91
104
  prerelease: false
92
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -95,12 +108,12 @@ dependencies:
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  - !ruby/object:Gem::Dependency
111
+ name: hoe-bundler
98
112
  requirement: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
116
  version: '0'
103
- name: hoe-bundler
104
117
  type: :development
105
118
  prerelease: false
106
119
  version_requirements: !ruby/object:Gem::Requirement
@@ -109,12 +122,12 @@ dependencies:
109
122
  - !ruby/object:Gem::Version
110
123
  version: '0'
111
124
  - !ruby/object:Gem::Dependency
125
+ name: hoe-gemspec
112
126
  requirement: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - ">="
115
129
  - !ruby/object:Gem::Version
116
130
  version: '0'
117
- name: hoe-gemspec
118
131
  type: :development
119
132
  prerelease: false
120
133
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,12 +136,12 @@ dependencies:
123
136
  - !ruby/object:Gem::Version
124
137
  version: '0'
125
138
  - !ruby/object:Gem::Dependency
139
+ name: rake
126
140
  requirement: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - ">="
129
143
  - !ruby/object:Gem::Version
130
144
  version: '0'
131
- name: rake
132
145
  type: :development
133
146
  prerelease: false
134
147
  version_requirements: !ruby/object:Gem::Requirement
@@ -137,12 +150,12 @@ dependencies:
137
150
  - !ruby/object:Gem::Version
138
151
  version: '0'
139
152
  - !ruby/object:Gem::Dependency
153
+ name: rspec-its
140
154
  requirement: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - ">="
143
157
  - !ruby/object:Gem::Version
144
158
  version: '0'
145
- name: rspec-its
146
159
  type: :development
147
160
  prerelease: false
148
161
  version_requirements: !ruby/object:Gem::Requirement
@@ -151,12 +164,12 @@ dependencies:
151
164
  - !ruby/object:Gem::Version
152
165
  version: '0'
153
166
  - !ruby/object:Gem::Dependency
167
+ name: rspec-mocks
154
168
  requirement: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - ">="
157
171
  - !ruby/object:Gem::Version
158
172
  version: '0'
159
- name: rspec-mocks
160
173
  type: :development
161
174
  prerelease: false
162
175
  version_requirements: !ruby/object:Gem::Requirement
@@ -165,12 +178,12 @@ dependencies:
165
178
  - !ruby/object:Gem::Version
166
179
  version: '0'
167
180
  - !ruby/object:Gem::Dependency
181
+ name: async
168
182
  requirement: !ruby/object:Gem::Requirement
169
183
  requirements:
170
184
  - - "<"
171
185
  - !ruby/object:Gem::Version
172
186
  version: '2'
173
- name: async
174
187
  type: :development
175
188
  prerelease: false
176
189
  version_requirements: !ruby/object:Gem::Requirement
@@ -179,12 +192,12 @@ dependencies:
179
192
  - !ruby/object:Gem::Version
180
193
  version: '2'
181
194
  - !ruby/object:Gem::Dependency
195
+ name: ruby-maven
182
196
  requirement: !ruby/object:Gem::Requirement
183
197
  requirements:
184
198
  - - ">="
185
199
  - !ruby/object:Gem::Version
186
200
  version: '0'
187
- name: ruby-maven
188
201
  type: :development
189
202
  prerelease: false
190
203
  version_requirements: !ruby/object:Gem::Requirement
@@ -193,6 +206,7 @@ dependencies:
193
206
  - !ruby/object:Gem::Version
194
207
  version: '0'
195
208
  - !ruby/object:Gem::Dependency
209
+ name: rdoc
196
210
  requirement: !ruby/object:Gem::Requirement
197
211
  requirements:
198
212
  - - ">="
@@ -201,7 +215,6 @@ dependencies:
201
215
  - - "<"
202
216
  - !ruby/object:Gem::Version
203
217
  version: '7'
204
- name: rdoc
205
218
  type: :development
206
219
  prerelease: false
207
220
  version_requirements: !ruby/object:Gem::Requirement
@@ -226,8 +239,8 @@ files:
226
239
  - jruby/neo4j/driver.rb
227
240
  - jruby/neo4j/driver/ext/async_converter.rb
228
241
  - jruby/neo4j/driver/ext/auth_tokens.rb
229
- - jruby/neo4j/driver/ext/bookmark.rb
230
242
  - jruby/neo4j/driver/ext/config_converter.rb
243
+ - jruby/neo4j/driver/ext/delegating_transaction_context.rb
231
244
  - jruby/neo4j/driver/ext/exception_checkable.rb
232
245
  - jruby/neo4j/driver/ext/exception_mapper.rb
233
246
  - jruby/neo4j/driver/ext/graph_database.rb
@@ -235,8 +248,7 @@ files:
235
248
  - jruby/neo4j/driver/ext/internal/cluster/routing_table_registry_impl.rb
236
249
  - jruby/neo4j/driver/ext/internal/cursor/disposable_async_result_cursor.rb
237
250
  - jruby/neo4j/driver/ext/internal/driver_factory.rb
238
- - jruby/neo4j/driver/ext/internal/internal_bookmark.rb
239
- - jruby/neo4j/driver/ext/internal/internal_notification_common.rb
251
+ - jruby/neo4j/driver/ext/internal/eager_result_value.rb
240
252
  - jruby/neo4j/driver/ext/internal/metrics/internal_connection_pool_metrics.rb
241
253
  - jruby/neo4j/driver/ext/internal/summary/internal_notification.rb
242
254
  - jruby/neo4j/driver/ext/internal/summary/internal_plan.rb
@@ -260,7 +272,7 @@ files:
260
272
  - jruby/neo4j/driver/version.rb
261
273
  - lib/neo4j-ruby-driver.rb
262
274
  - lib/neo4j-ruby-driver_loader.rb
263
- - lib/neo4j/driver/auto_closable.rb
275
+ - lib/neo4j/driver/auto_closeable.rb
264
276
  - lib/neo4j/driver/exceptions/authentication_exception.rb
265
277
  - lib/neo4j/driver/exceptions/authorization_expired_exception.rb
266
278
  - lib/neo4j/driver/exceptions/certificate_exception.rb
@@ -288,6 +300,7 @@ files:
288
300
  - lib/neo4j/driver/exceptions/value/unsizable.rb
289
301
  - lib/neo4j/driver/exceptions/value/value_exception.rb
290
302
  - lib/neo4j/driver/internal/bolt_server_address.rb
303
+ - lib/neo4j/driver/internal/deprecator.rb
291
304
  - lib/neo4j/driver/internal/duration_normalizer.rb
292
305
  - lib/neo4j/driver/internal/validator.rb
293
306
  - lib/neo4j/driver/summary/query_type.rb
@@ -303,7 +316,6 @@ licenses:
303
316
  - MIT
304
317
  metadata:
305
318
  homepage_uri: https://github.com/neo4jrb/neo4j-ruby-driver
306
- post_install_message:
307
319
  rdoc_options:
308
320
  - "--main"
309
321
  - README.md
@@ -314,16 +326,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
326
  requirements:
315
327
  - - ">="
316
328
  - !ruby/object:Gem::Version
317
- version: '2.6'
329
+ version: '3.1'
318
330
  required_rubygems_version: !ruby/object:Gem::Requirement
319
331
  requirements:
320
- - - ">"
332
+ - - ">="
321
333
  - !ruby/object:Gem::Version
322
- version: 1.3.1
334
+ version: '0'
323
335
  requirements:
324
- - jar org.neo4j.driver, neo4j-java-driver-all, 5.19.0
325
- rubygems_version: 3.3.26
326
- signing_key:
336
+ - jar org.neo4j.driver, neo4j-java-driver-all, 6.0.1
337
+ - jar org.neo4j.driver, neo4j-java-driver-observation-metrics, 6.0.1
338
+ rubygems_version: 3.6.9
327
339
  specification_version: 4
328
340
  summary: ''
329
341
  test_files: []
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Neo4j
4
- module Driver
5
- module Ext
6
- module Bookmark
7
- module ClassMethods
8
- def from(*values)
9
- super(java.util.HashSet.new(values))
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- module Neo4j
2
- module Driver
3
- module Ext
4
- module Internal
5
- module InternalBookmark
6
- def values
7
- super.to_set
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- module Neo4j
2
- module Driver
3
- module Ext
4
- module Internal
5
- module InternalNotificationCommon
6
- def type
7
- super.to_s
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end