activegraph 12.0.0.beta.7 → 12.0.1

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: 855f60d7bca8cec018819f65c0765be6002683af5617b3ec2e81b8c0cc5559e0
4
- data.tar.gz: 06261c803fc0c5ed98d7b32b4bb621f7d2a239b8519c7f23e9c2c84458018271
3
+ metadata.gz: f4b65d35d5aad8b65eb4893dce27de5f5c51768d22a4d888f2c6b6b422e7675f
4
+ data.tar.gz: 368d9faf2918e4603aeffdbe8095b1a2c83d284b40d80f3c550a6eee6307ad81
5
5
  SHA512:
6
- metadata.gz: d815973f66662ea91c56b12c0bde8cc5ae17ce5df727c19f735397cce96e4b4549dcda7a1c84fd26dfe645b4ac0602a303a1cd4e2e2aecb33801d7d8d462e4fb
7
- data.tar.gz: 9e3bf57529430fad4cfb4332bc48f497bf19f17ade7dae94f1047e9a26d953a74b04f157223b1a382a0f07b7422b4f018e47a1bdd60d6dc964f607060e2636d3
6
+ metadata.gz: a6f8734697c2c335748a515f2cd124fed3083ed7a03e322909df97e58d8b83e922bd34f579f1ac906d6cb674e16e77250cbfe442d9d7bd2d0ae89211f58cefa9
7
+ data.tar.gz: 382bc1bc3724db5a4892fa184a0d108ebbc36ff029651ed4a03f3e1b1f4a9793bcafa52610d8695ac2932570067b86b2cea70b3b8ebbfd5ac5304b4926d73245
data/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file.
3
3
  This file should follow the standards specified on [http://keepachangelog.com/]
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [12.0.1] (2026-10-29)
7
+
8
+ ### Fixed
9
+ - Updated dependency 'neo4j-ruby-driver' to stable release version 6.2.1
10
+ - Make JSON properties work with json >= 3.0 ([#1748](https://github.com/neo4jrb/activegraph/pull/1748))
11
+ - Update 'neo4j-ruby-driver' version to 6.3.0 ([#1747](https://github.com/neo4jrb/activegraph/pull/1747))
12
+
13
+ ## [12.0.0] (2026-08-16)
14
+
15
+ ### Changed
16
+ - Use the driver-native Neo4j::Driver::Types::Duration instead of ActiveSupport::Duration
17
+
18
+ ### Added
19
+ - Type converted for ActiveSupport::Duration to Neo4j::Driver::Types::Duration for backward compatibility. The converter is lossy if fractional units are used in ActiveSupport::Duration.
20
+
21
+ ### Fixed
22
+ - Adapt to neo4j-ruby-driver 6.2.1
23
+
6
24
  ## [12.0.0.beta.7] (2026-03-19)
7
25
 
8
26
  ### Fixed
@@ -243,12 +261,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
243
261
 
244
262
  - Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
245
263
 
246
- ## [9.1.8] 2018-03-27
247
-
248
- ## Fixed
249
-
250
- - Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
251
-
252
264
  ## [9.1.7] 2018-03-27
253
265
 
254
266
  ## Fixed
data/Gemfile CHANGED
@@ -3,7 +3,13 @@ source 'http://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  active_model_version = ENV['ACTIVE_MODEL_VERSION']
6
- gem 'activemodel', "~> #{active_model_version}" if active_model_version&.length&.positive?
6
+ if active_model_version&.length&.positive?
7
+ gem 'activemodel', "~> #{active_model_version}"
8
+ # ActiveSupport < 8.1 passes the long-removed `quirks_mode` option to JSON.generate, which json >= 3
9
+ # rejects (fixed upstream in Rails 8.1 and on 8-0-stable, unreleased as of 8.0.5.1). Apps on those
10
+ # Rails versions must hold json below 3 themselves; mirror that for the matching CI rows.
11
+ gem 'json', '< 3' if Gem::Version.new(active_model_version) < Gem::Version.new('8.1')
12
+ end
7
13
 
8
14
  group 'test' do
9
15
  # gem 'coveralls', require: false
data/README.md CHANGED
@@ -76,6 +76,15 @@ Neo4j.rb v4.1.0 was released in January of 2015. Its changes are outlined [here]
76
76
  | Causal Cluster | No | No | No | No | Yes |
77
77
  | Embedded JVM support | Yes | Yes | Yes | Yes | via bolt only |
78
78
 
79
+ ## Rails version support
80
+
81
+ activegraph 12 is tested against ActiveModel 7.1, 7.2, 8.0 and 8.1.
82
+
83
+ Note that ActiveSupport < 8.1 is incompatible with the `json` gem >= 3.0 (its JSON encoder passes an option
84
+ that json 3 rejects, see [rails/rails#54224](https://github.com/rails/rails/pull/54224)). This affects every
85
+ `to_json` call in such an application, not only activegraph's JSON-typed properties, so on Rails < 8.1 pin
86
+ `gem 'json', '< 3'` in your Gemfile until you upgrade to a Rails release that includes the fix.
87
+
79
88
  ## Documentation
80
89
 
81
90
  * [Website](http://neo4jrb.io/) (for an introduction)
data/activegraph.gemspec CHANGED
@@ -33,7 +33,7 @@ DESCRIPTION
33
33
  s.add_dependency('activemodel')
34
34
  s.add_dependency('benchmark')
35
35
  s.add_dependency('i18n', '!= 1.8.8') # https://github.com/jruby/jruby/issues/6547
36
- s.add_dependency('neo4j-ruby-driver', '>= 6.0.3.alpha.0')
36
+ s.add_dependency('neo4j-ruby-driver', '~> 6.3.0')
37
37
  s.add_dependency('orm_adapter', '>= 0.5.0')
38
38
  s.add_development_dependency('guard')
39
39
  s.add_development_dependency('guard-rspec')
@@ -13,7 +13,7 @@ module ActiveGraph
13
13
 
14
14
  def each(&block)
15
15
  store if wrap? # TODO: why? This is preventing streaming
16
- @records&.each(&block) || super
16
+ @wrapped_records&.each(&block) || super
17
17
  end
18
18
 
19
19
  ## To avoid to_a on Neo4j::Driver::Result as that one does not call the above block
@@ -22,13 +22,13 @@ module ActiveGraph
22
22
  end
23
23
 
24
24
  def store
25
- return if @records
25
+ return if @wrapped_records
26
26
  keys
27
- @records = []
27
+ @wrapped_records = []
28
28
  # TODO: implement 'each' without block parameter
29
29
  method(:each).super_method.call do |record|
30
30
  record.wrap = wrap?
31
- @records << record
31
+ @wrapped_records << record
32
32
  end
33
33
  end
34
34
  end
@@ -59,8 +59,12 @@ module ActiveGraph
59
59
  @major ||= version.segments.first
60
60
  end
61
61
 
62
+ # Neo4j 2026.07+ renamed the uniqueness constraint types
63
+ # (UNIQUENESS -> NODE_PROPERTY_UNIQUENESS, RELATIONSHIP_UNIQUENESS ->
64
+ # RELATIONSHIP_PROPERTY_UNIQUENESS); accept both the old and new names.
62
65
  def constraint_filter(record)
63
- %w[UNIQUENESS RELATIONSHIP_UNIQUENESS RELATIONSHIP_PROPERTY_EXISTENCE NODE_PROPERTY_EXISTENCE NODE_KEY RELATIONSHIP_KEY].include?(record[:type])
66
+ %w[UNIQUENESS NODE_PROPERTY_UNIQUENESS RELATIONSHIP_UNIQUENESS RELATIONSHIP_PROPERTY_UNIQUENESS
67
+ RELATIONSHIP_PROPERTY_EXISTENCE NODE_PROPERTY_EXISTENCE NODE_KEY RELATIONSHIP_KEY].include?(record[:type])
64
68
  end
65
69
 
66
70
  def index_cypher(label, properties)
@@ -20,7 +20,7 @@ module ActiveGraph
20
20
  count = count_relations(relation_query)
21
21
  output "Indexing #{count} #{old_name}s into #{new_name}..."
22
22
  while count > 0
23
- relation_query.create("(a)-[r2:`#{new_name}`]->(b)").set('r2 = r').with(:r).limit(max_per_batch).delete(:r).exec
23
+ relation_query.create("(a)-[r2:`#{new_name}`]->(b)").set('r2 = properties(r)').with(:r).limit(max_per_batch).delete(:r).exec
24
24
  count = count_relations(relation_query)
25
25
  output "... #{count} #{old_name}'s left to go.." if count > 0
26
26
  end
@@ -12,7 +12,7 @@ module ActiveGraph::Shared
12
12
  attr_reader :_persisted_obj
13
13
 
14
14
  # This list should not be statically created. All types which have converters should by type casted
15
- NEO4J_DRIVER_DATA_TYPES = [Hash, ActiveSupport::Duration, Neo4j::Driver::Types::Point,
15
+ NEO4J_DRIVER_DATA_TYPES = [Hash, Neo4j::Driver::Types::Duration, Neo4j::Driver::Types::Point,
16
16
  Neo4j::Driver::Types::OffsetTime, Neo4j::Driver::Types::LocalTime, Neo4j::Driver::Types::LocalDateTime]
17
17
 
18
18
  # TODO: Set @attribute correctly using class ActiveModel::Attribute, and after that
@@ -185,6 +185,48 @@ module ActiveGraph::Shared
185
185
  end
186
186
  end
187
187
 
188
+ # Converts ActiveSupport::Duration to/from the driver-native
189
+ # Neo4j::Driver::Types::Duration. Kept for backwards compatibility: since
190
+ # driver 6.2.1 a Neo4j duration is a Types::Duration, but models may still
191
+ # declare `type: ActiveSupport::Duration`. The mapping is field-to-field
192
+ # (parts <-> months/days/seconds/nanoseconds) and value-exact; the only soft
193
+ # spot is a fractional calendar month, which has no exact finer form and
194
+ # degrades to seconds via ActiveSupport's own rate.
195
+ class DurationConverter < BaseConverter
196
+ class << self
197
+ def convert_type
198
+ ActiveSupport::Duration
199
+ end
200
+
201
+ def db_type
202
+ Neo4j::Driver::Types::Duration
203
+ end
204
+
205
+ def to_db(value)
206
+ parts = Hash.new(0).merge(value.parts)
207
+ months_f = parts[:years] * 12 + parts[:months]
208
+ days_f = parts[:weeks] * 7 + parts[:days]
209
+ months = months_f.to_i
210
+ days = days_f.to_i
211
+ # whole calendar units stay put; fractional months/days cascade into
212
+ # seconds rather than truncating (which would lose magnitude)
213
+ seconds = parts[:hours] * 3600 + parts[:minutes] * 60 + parts[:seconds] +
214
+ (months_f - months) * ActiveSupport::Duration::SECONDS_PER_MONTH +
215
+ (days_f - days) * ActiveSupport::Duration::SECONDS_PER_DAY
216
+ Neo4j::Driver::Types::Duration.new(months, days, seconds.floor, ((seconds % 1) * 1_000_000_000).round)
217
+ end
218
+
219
+ def to_ruby(value)
220
+ return value if value.is_a?(ActiveSupport::Duration)
221
+ # map each Neo4j field back to its ActiveSupport unit, field-to-field,
222
+ # so the calendar structure survives the round trip
223
+ ActiveSupport::Duration.months(value.months) +
224
+ ActiveSupport::Duration.days(value.days) +
225
+ ActiveSupport::Duration.seconds(value.seconds + Rational(value.nanoseconds, 1_000_000_000))
226
+ end
227
+ end
228
+ end
229
+
188
230
  class BooleanConverter < BaseConverter
189
231
  FALSE_VALUES = %w(n N no No NO false False FALSE off Off OFF f F).to_set
190
232
 
@@ -256,11 +298,13 @@ module ActiveGraph::Shared
256
298
  end
257
299
 
258
300
  def to_db(value)
259
- value.to_json
301
+ ActiveSupport::JSON.encode(value)
260
302
  end
261
303
 
262
304
  def to_ruby(value)
263
- JSON.parse(value, quirks_mode: true)
305
+ # `quirks_mode` was removed from the json gem in 2.0 (scalar top-level values are accepted
306
+ # by default since) and json >= 3.0 raises on unknown options.
307
+ JSON.parse(value)
264
308
  end
265
309
  end
266
310
  end
@@ -1,11 +1,11 @@
1
1
  module ActiveGraph
2
2
  module Transaction
3
3
  def rollback
4
- @rolled_back = true
4
+ @active_graph_rolled_back = true
5
5
  end
6
6
 
7
7
  def check_rollback
8
- fail ActiveGraph::Rollback if @rolled_back
8
+ fail ActiveGraph::Rollback if @active_graph_rolled_back
9
9
  end
10
10
 
11
11
  def after_commit(&block)
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '12.0.0.beta.7'
2
+ VERSION = '12.0.1'
3
3
  end
data/lib/active_graph.rb CHANGED
@@ -10,9 +10,12 @@ require 'active_support/core_ext/class/attribute'
10
10
  require 'active_support/core_ext/class/subclasses'
11
11
  require 'active_support/core_ext/module/attribute_accessors'
12
12
  require 'active_support/core_ext/module/attribute_accessors_per_thread'
13
+ require 'active_support/core_ext/numeric/time'
14
+ require 'active_support/core_ext/integer/time'
13
15
  require 'active_support/core_ext/string/conversions'
14
16
  require 'active_support/inflector'
15
17
  require 'active_support/inflector/inflections'
18
+ require 'active_support/json'
16
19
  require 'active_support/notifications'
17
20
  require 'json'
18
21
  require 'neo4j/driver'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activegraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.0.beta.7
4
+ version: 12.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
@@ -55,16 +55,16 @@ dependencies:
55
55
  name: neo4j-ruby-driver
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 6.0.3.alpha.0
60
+ version: 6.3.0
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 6.0.3.alpha.0
67
+ version: 6.3.0
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: orm_adapter
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -431,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
431
  - !ruby/object:Gem::Version
432
432
  version: '0'
433
433
  requirements: []
434
- rubygems_version: 4.0.3
434
+ rubygems_version: 4.0.20
435
435
  specification_version: 4
436
436
  summary: A graph database for Ruby
437
437
  test_files: []