activegraph 10.0.0.pre.beta.11 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a3aec17e64744af3f8b985b56efb4ce1f9281cee7d975609962607b5bb42e02
4
- data.tar.gz: c0af63007c35b6ed74802908d0347e244a5fb7a1a71a191c429a5e331639a516
3
+ metadata.gz: 66259444a09dbe560ec1a284b7c1988b24eaf4b29386efb63664cef081edf520
4
+ data.tar.gz: ec43759b43c92f62a93589225207e0d37ef1d18ee4b61d5f4f204b89b8985787
5
5
  SHA512:
6
- metadata.gz: 8c08db996d04dd5c4680c8a199246ead79058328a5090e28786b274b271ae207d934b5f1595f804581008354136ae2c18a479d7ac21415232091a8a2b7b030c6
7
- data.tar.gz: 975c18e155473c98cb4551c2e70a0f1645296d1e31e5e4728052a0fb054a2e20aac89fce8e41e702e041ca09e7839d856ad9ee20e31ea88d2fd7ec4e4b55057a
6
+ metadata.gz: ec40cecc16c133c065672a3aa37360c304bba5cf24fe430dda7a789885262a7b239b798a7998b6d96b34ba8d05d5d0376c134dc829d6db0800e392fb740c0ec7
7
+ data.tar.gz: 9f7fc129cf6916cdf69373ebb789ff7bc5f6c38c675d3e51403c4b0e6e7135a9649cfb2f3f754634507979a371de2a6a16f8670c765e38a016627c21f04e8535
@@ -3,11 +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
- ## [10.0.x] 2020-01-23
7
-
8
- - Executing relationship callbacks on relationship deletion.
9
- - When assiging relationships, preserving earlier relationships.
10
- - Enforcing has one constraint on relationships.
6
+ ## [10.0.0] 2020-07-06
7
+
8
+ - neo4j 4.0 support (default database only)
9
+ - dropped support for neo4j 3.3 or earlier
10
+ - full bolt support
11
+ - full causal cluster support
12
+ - removal of http support
13
+ - removal of embedded support (neo4j embedded is still supported via bolt)
14
+ - support for a neo4j ruby driver with an api of the official drivers
15
+ - discontinuation of the ``neo4j-core`` gem. Its functionality is replaced partially by ``neo4j-ruby-driver`` and
16
+ partially by ``activegraph``
17
+ - higher naming consistency with ``activerecord`` and the official ``neo4j-java-driver``
18
+ - configuration more consistent with ``activerecord``
19
+ - changed transaction API
20
+ - support for sessions with bookmarks and read and write transaction
21
+ - enforcing has one constraint on relationships
22
+ - better handling of has_many (no deletion and recreation)
23
+ - executing association callbacks on relationship deletion
11
24
 
12
25
  ## [9.6.1] 2019-12-18
13
26
 
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  ### Documentation
13
13
 
14
- All new documentation will be done via our [readthedocs](http://neo4jrb.readthedocs.org) site, though some old documentation has yet to be moved from our [wiki](https://github.com/neo4jrb/neo4j/wiki) (also there is the [neo4j-core wiki](https://github.com/neo4jrb/neo4j-core/wiki))
14
+ All new documentation will be done via our [readthedocs](http://neo4jrb.readthedocs.org) site, though some old documentation has yet to be moved from our [wiki](https://github.com/neo4jrb/neo4j/wiki)
15
15
 
16
16
  ### Contact Us
17
17
 
@@ -45,27 +45,31 @@ Neo4j.rb v4.1.0 was released in January of 2015. Its changes are outlined [here]
45
45
 
46
46
  ## Neo4j version support
47
47
 
48
- | **Neo4j Version** | v2.x | v3.x | >= v4.x | >= 7.0.3 |
49
- |-------------------|------|-------|---------|----------|
50
- | 1.9.x | Yes | No | No | No |
51
- | 2.0.x | No | Yes | No | No |
52
- | 2.1.x | No | Yes | Yes * | Yes |
53
- | 2.2.x | No | No | Yes | Yes |
54
- | 2.3.x | No | No | Yes | Yes |
55
- | >= 3.0.0 | No | No | No | Yes |
48
+ | **Neo4j Version** | v2.x | v3.x | >= v4.x | >= 7.0.3 | activegraph 10.0 |
49
+ |-------------------|------|-------|---------|----------|------------------|
50
+ | 1.9.x | Yes | No | No | No | No |
51
+ | 2.0.x | No | Yes | No | No | No |
52
+ | 2.1.x | No | Yes | Yes * | Yes | No |
53
+ | 2.2.x | No | No | Yes | Yes | No |
54
+ | 2.3.x | No | No | Yes | Yes | No |
55
+ | 3.0, 3.1, 3.3 | No | No | No | Yes | No |
56
+ | 3.4, 3.5 | No | No | No | Yes | Yes |
57
+ | 4.0 | No | No | No | No | Yes |
58
+ | 4.1 | No | No | No | No | No |
56
59
 
57
60
  `*` Neo4j.rb >= 4.x doesn't support Neo4j versions before 2.1.5. To use 2.1.x you should upgrade to a version >= 2.1.5
58
61
 
59
62
  ## Neo4j feature support
60
63
 
61
- | **Neo4j Feature** | v2.x | v3.x | >= v4.x | >= 8.x |
62
- |----------------------------|--------|------|---------|--------|
63
- | Bolt Protocol | No | No | No | Yes |
64
- | Auth | No | No | Yes | Yes |
65
- | Remote Cypher | Yes | Yes | Yes | Yes |
66
- | Transactions | Yes | Yes | Yes | Yes |
67
- | High Availability | No | Yes | Yes | Yes |
68
- | Embedded JVM support | Yes | Yes | Yes | Yes |
64
+ | **Neo4j Feature** | v2.x | v3.x | >= v4.x | >= 8.x | activegraph 10.0 |
65
+ |----------------------------|--------|------|---------|--------|------------------|
66
+ | Bolt Protocol | No | No | No | Yes | Yes |
67
+ | Auth | No | No | Yes | Yes | Yes |
68
+ | Remote Cypher | Yes | Yes | Yes | Yes | No |
69
+ | Transactions | Yes | Yes | Yes | Yes | Yes |
70
+ | High Availability | No | Yes | Yes | Yes | Yes |
71
+ | Causal Cluster | No | No | No | No | Yes |
72
+ | Embedded JVM support | Yes | Yes | Yes | Yes | via bolt only |
69
73
 
70
74
  ## Documentation
71
75
 
@@ -38,7 +38,7 @@ DESCRIPTION
38
38
  s.add_development_dependency('guard-rspec')
39
39
  s.add_development_dependency('guard-rubocop')
40
40
  s.add_development_dependency('neo4j-rake_tasks', '>= 0.3.0')
41
- s.add_development_dependency("neo4j-#{ENV['driver'] == 'java' ? 'java' : 'ruby'}-driver", '>= 0.4.1')
41
+ s.add_development_dependency("neo4j-#{ENV['driver'] == 'java' ? 'java' : 'ruby'}-driver", '~> 1.7.0')
42
42
  s.add_development_dependency('os')
43
43
  s.add_development_dependency('pry')
44
44
  s.add_development_dependency('railties', '>= 4.0')
@@ -402,7 +402,7 @@ module ActiveGraph::Node
402
402
  #
403
403
  # This would define the methods: ``#vehicle``, ``#vehicle=``, and ``.vehicle``.
404
404
  #
405
- # See :ref:`#has_many <Neo4j/Node/HasN/ClassMethods#has_many>` for anything
405
+ # See :ref:`#has_many <ActiveGraph/Node/HasN/ClassMethods#has_many>` for anything
406
406
  # not specified here
407
407
  #
408
408
  def has_one(direction, name, options = {}) # rubocop:disable Naming/PredicateName
@@ -21,7 +21,7 @@ module ActiveGraph
21
21
  class RecordNotFound < ActiveGraph::RecordNotFound; end
22
22
 
23
23
  # @return the labels
24
- # @see Neo4j-core
24
+ # @see ActiveGraph::Core
25
25
  def labels
26
26
  @_persisted_obj.labels
27
27
  end
@@ -32,7 +32,7 @@ module ActiveGraph
32
32
  # end
33
33
 
34
34
  # adds one or more labels
35
- # @see Neo4j-core
35
+ # @see ActiveGraph::Core
36
36
  def add_labels(*labels)
37
37
  labels.inject(query_as(:n)) do |query, label|
38
38
  query.set("n:`#{label}`")
@@ -43,7 +43,7 @@ module ActiveGraph
43
43
 
44
44
  # Removes one or more labels
45
45
  # Be careful, don't remove the label representing the Ruby class.
46
- # @see Neo4j-core
46
+ # @see ActiveGraph::Core
47
47
  def remove_labels(*labels)
48
48
  labels.inject(query_as(:n)) do |query, label|
49
49
  query.remove("n:`#{label}`")
@@ -30,8 +30,8 @@ module ActiveGraph::Node
30
30
  end
31
31
 
32
32
  # Increments concurrently a numeric attribute by a centain amount
33
- # @param [Symbol, String] name of the attribute to increment
34
- # @param [Integer, Float] amount to increment
33
+ # @param [Symbol, String] attribute name of the attribute to increment
34
+ # @param [Integer, Float] by amount to increment
35
35
  def concurrent_increment!(attribute, by = 1)
36
36
  increment_by_query! query_as(:n), attribute, by
37
37
  end
@@ -16,7 +16,7 @@ module ActiveGraph
16
16
  attr_reader :source_object, :association, :model, :starting_query
17
17
 
18
18
  # QueryProxy is Node's Cypher DSL. While the name might imply that it creates queries in a general sense,
19
- # it is actually referring to <tt>ActiveGraph::Core::Query</tt>, which is a pure Ruby Cypher DSL provided by the <tt>neo4j-core</tt> gem.
19
+ # it is actually referring to <tt>ActiveGraph::Core::Query</tt>, which is a pure Ruby Cypher DSL provided by the <tt>activegraph</tt> gem.
20
20
  # QueryProxy provides ActiveRecord-like methods for common patterns. When it's not handling CRUD for relationships and queries, it
21
21
  # provides Node's association chaining (`student.lessons.teachers.where(age: 30).hobbies`) and enjoys long walks on the
22
22
  # beach.
@@ -82,7 +82,7 @@ module ActiveGraph
82
82
 
83
83
  alias blank? empty?
84
84
 
85
- # @param [ActiveGraph::Node, ActiveGraph::Node, String] other An instance of a Neo4j.rb model, a Neo4j-core node, or a string uuid
85
+ # @param [ActiveGraph::Node, ActiveGraph::Node, String] other An instance of a Neo4j.rb model, a core node, or a string uuid
86
86
  # @param [String, Symbol] target An identifier of a link in the Cypher chain
87
87
  # @return [Boolean]
88
88
  def include?(other, target = nil)
@@ -2,12 +2,13 @@ require 'active_support/notifications'
2
2
  require 'rails/railtie'
3
3
  # Need the action_dispatch railtie to have action_dispatch.rescue_responses initialized correctly
4
4
  require 'action_dispatch/railtie'
5
+ require 'active_graph'
5
6
 
6
7
  module ActiveGraph
7
8
  class Railtie < ::Rails::Railtie
8
9
  def empty_config
9
10
  ActiveSupport::OrderedOptions.new.tap do |cfg|
10
- cfg.driver = ActiveSupport::OrderedOptions.new.tap { |cfg| cfg.config = ActiveSupport::OrderedOptions.new }
11
+ cfg.driver = ActiveSupport::OrderedOptions.new
11
12
  end
12
13
  end
13
14
 
@@ -58,31 +59,29 @@ module ActiveGraph
58
59
  end
59
60
  end
60
61
 
61
- def setup!(neo4j_config = empty_config)
62
- url, path, auth_token, username, password, config =
63
- final_driver_config!(neo4j_config).values_at(:url, :path, :auth_token, :username, :password, :config)
62
+ def setup!(config = empty_config)
63
+ config = final_driver_config!(config)
64
+ scheme = config.delete(:scheme) || 'bolt'
65
+ host = config.delete(:host) || 'localhost'
66
+ port = config.delete(:port) || 7687
67
+ url = config.delete(:url) || URI::Generic.build( scheme: scheme, host: host, port: port ).to_s
68
+ username = config.delete(:username)
69
+ password = config.delete(:password)
70
+ auth_token = config.delete(:auth_token)
64
71
  auth_token ||= username ? Neo4j::Driver::AuthTokens.basic(username, password) : Neo4j::Driver::AuthTokens.none
65
72
  register_neo4j_cypher_logging
66
73
 
67
- url ||= path || default_driver_path_or_url
68
74
  method = url.is_a?(Enumerable) ? :routing_driver : :driver
69
75
  Neo4j::Driver::GraphDatabase.send(method, url, auth_token, config)
70
76
  end
71
77
 
72
- def final_driver_config!(neo4j_config)
73
- (neo4j_config[:driver].empty? ? yaml_config_data : neo4j_config[:driver]).dup
74
- end
75
-
76
- def default_driver_path_or_url
77
- ENV['NEO4J_URL'] || ENV['NEO4J_PATH'] || 'bolt://localhost:7474'
78
+ def final_driver_config!(config)
79
+ { url: ENV['NEO4J_URL'] }.compact.merge(config[:driver]).merge(yaml_config_data)
78
80
  end
79
81
 
80
82
  def yaml_config_data
81
- @yaml_config_data ||= if yaml_path
82
- HashWithIndifferentAccess.new(YAML.load(ERB.new(yaml_path.read).result)[Rails.env])
83
- else
84
- {}
85
- end
83
+ @yaml_config_data ||=
84
+ yaml_path ? YAML.load(ERB.new(yaml_path.read).result)[Rails.env].transform_keys!(&:to_sym) : {}
86
85
  end
87
86
 
88
87
  def yaml_path
@@ -37,8 +37,8 @@ module ActiveGraph::Relationship
37
37
  end
38
38
 
39
39
  # Increments concurrently a numeric attribute by a centain amount
40
- # @param [Symbol, String] name of the attribute to increment
41
- # @param [Integer, Float] amount to increment
40
+ # @param [Symbol, String] attribute name of the attribute to increment
41
+ # @param [Integer, Float] by amount to increment
42
42
  def concurrent_increment!(attribute, by = 1)
43
43
  increment_by_query! query_as(:r), attribute, by, :r
44
44
  end
@@ -65,7 +65,7 @@ module ActiveGraph::Relationship
65
65
 
66
66
  module ClassMethods
67
67
  # Creates a new relationship between objects
68
- # @param [Hash] props the properties the new relationship should have
68
+ # @param [Hash] args the properties the new relationship should have
69
69
  def create(*args)
70
70
  new(*args).tap(&:save)
71
71
  end
@@ -189,7 +189,7 @@ module ActiveGraph::Shared
189
189
 
190
190
  # Assign a set of attribute definitions, used when subclassing models
191
191
  #
192
- # @param [Array<ActiveGraph::Shared::DeclaredProperties>] The Array of
192
+ # @param [Array<ActiveGraph::Shared::DeclaredProperties>] attributes The Array of
193
193
  # AttributeDefinition instances
194
194
  def attributes=(attributes)
195
195
  @attributes = attributes
@@ -9,7 +9,7 @@ module ActiveGraph
9
9
 
10
10
  included do
11
11
  include ActiveModel::Validations::Callbacks
12
- # after_find is triggered by the `find` method defined in lib/neo4j/node/id_property.rb
12
+ # after_find is triggered by the `find` method defined in lib/active_graph/node/id_property.rb
13
13
  define_model_callbacks :initialize, :find, only: :after
14
14
  define_model_callbacks :create_commit, :update_commit, :destroy_commit, only: :after
15
15
  define_model_callbacks :save, :create, :update, :destroy, :touch
@@ -75,7 +75,7 @@ module ActiveGraph::Shared
75
75
  end.freeze
76
76
  end
77
77
 
78
- # During object wrapping, a props hash is built with string keys but Neo4j-core provides symbols.
78
+ # During object wrapping, a props hash is built with string keys but ActiveGraph::Core provides symbols.
79
79
  # Rather than a `to_s` or `symbolize_keys` during every load, we build a map of symbol-to-string
80
80
  # to speed up the process. This increases memory used by the gem but reduces object allocation and GC, so it is faster
81
81
  # in practice.
@@ -19,9 +19,8 @@ module ActiveGraph::Shared
19
19
  # person.first_name #=> "Chris"
20
20
  # person.last_name #=> "Griego"
21
21
  #
22
- # @param [Hash{#to_s => Object}, #each] attributes Attributes used to
22
+ # @param [Hash{#to_s => Object}, #each] new_attributes Attributes used to
23
23
  # populate the model
24
- # @param [Hash, #[]] options Options that affect mass assignment
25
24
  def assign_attributes(new_attributes = nil)
26
25
  return unless new_attributes.present?
27
26
  new_attributes.each do |name, value|
@@ -46,8 +46,8 @@ module ActiveGraph::Shared
46
46
  end
47
47
 
48
48
  # Increments a numeric attribute by a centain amount
49
- # @param [Symbol, String] name of the attribute to increment
50
- # @param [Integer, Float] amount to increment
49
+ # @param [Symbol, String] attribute name of the attribute to increment
50
+ # @param [Integer, Float] by amount to increment
51
51
  def increment(attribute, by = 1)
52
52
  self[attribute] ||= 0
53
53
  self[attribute] += by
@@ -55,15 +55,15 @@ module ActiveGraph::Shared
55
55
  end
56
56
 
57
57
  # Convenience method to increment numeric attribute and #save at the same time
58
- # @param [Symbol, String] name of the attribute to increment
59
- # @param [Integer, Float] amount to increment
58
+ # @param [Symbol, String] attribute name of the attribute to increment
59
+ # @param [Integer, Float] by amount to increment
60
60
  def increment!(attribute, by = 1)
61
61
  increment(attribute, by).update_attribute(attribute, self[attribute])
62
62
  end
63
63
 
64
64
  # Increments concurrently a numeric attribute by a centain amount
65
- # @param [Symbol, String] name of the attribute to increment
66
- # @param [Integer, Float] amount to increment
65
+ # @param [Symbol, String] _attribute name of the attribute to increment
66
+ # @param [Integer, Float] _by amount to increment
67
67
  def concurrent_increment!(_attribute, _by = 1)
68
68
  fail 'not_implemented'
69
69
  end
@@ -132,7 +132,7 @@ module ActiveGraph::Shared
132
132
  # Defines a property on the class
133
133
  #
134
134
  # See active_attr gem for allowed options, e.g which type
135
- # Notice, in Neo4j you don't have to declare properties before using them, see the neo4j-core api.
135
+ # Notice, in ActiveGraph you don't have to declare properties before using them, see the ActiveGraph::Coree api.
136
136
  #
137
137
  # @example Without type
138
138
  # class Person
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '10.0.0-beta.11'
2
+ VERSION = '10.0.0'
3
3
  end
@@ -1,4 +1,6 @@
1
1
  class Create<%= @migration_class_name.underscore.camelize %> < ActiveGraph::Migrations::Base
2
+ disable_transactions!
3
+
2
4
  def up
3
5
  add_constraint :<%= class_name %>, :uuid
4
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activegraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.0.pre.beta.11
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-14 00:00:00.000000000 Z
11
+ date: 2020-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: neo4j-ruby-driver
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.4.1
131
+ version: 1.7.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.4.1
138
+ version: 1.7.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: os
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -412,9 +412,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
412
412
  version: '2.5'
413
413
  required_rubygems_version: !ruby/object:Gem::Requirement
414
414
  requirements:
415
- - - ">"
415
+ - - ">="
416
416
  - !ruby/object:Gem::Version
417
- version: 1.3.1
417
+ version: '0'
418
418
  requirements: []
419
419
  rubygems_version: 3.1.2
420
420
  signing_key: