activegraph 11.4.0 → 11.5.0.beta.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 +4 -4
- data/CHANGELOG.md +12 -1
- data/Gemfile +0 -4
- data/activegraph.gemspec +5 -6
- data/lib/active_graph/attribute_set.rb +0 -4
- data/lib/active_graph/base.rb +0 -3
- data/lib/active_graph/config.rb +0 -1
- data/lib/active_graph/core/instrumentable.rb +0 -5
- data/lib/active_graph/core/querable.rb +0 -5
- data/lib/active_graph/core/query.rb +4 -7
- data/lib/active_graph/core/query_ext.rb +1 -1
- data/lib/active_graph/core/record.rb +0 -5
- data/lib/active_graph/core/result.rb +5 -0
- data/lib/active_graph/core/wrappable.rb +1 -1
- data/lib/active_graph/lazy_attribute_hash.rb +0 -2
- data/lib/active_graph/migration.rb +0 -3
- data/lib/active_graph/migrations/helpers.rb +0 -7
- data/lib/active_graph/migrations/runner.rb +0 -4
- data/lib/active_graph/migrations.rb +0 -8
- data/lib/active_graph/model_schema.rb +0 -1
- data/lib/active_graph/node/has_n/association.rb +0 -3
- data/lib/active_graph/node/has_n.rb +5 -1
- data/lib/active_graph/node/labels.rb +1 -3
- data/lib/active_graph/node/orm_adapter.rb +0 -6
- data/lib/active_graph/node/query/query_proxy_methods_of_mass_updating.rb +1 -0
- data/lib/active_graph/node/scope.rb +4 -43
- data/lib/active_graph/node/wrapping.rb +52 -0
- data/lib/active_graph/node.rb +1 -0
- data/lib/active_graph/railtie.rb +11 -4
- data/lib/active_graph/relationship/property.rb +0 -2
- data/lib/active_graph/relationship/wrapping.rb +26 -0
- data/lib/active_graph/shared/attributes.rb +3 -2
- data/lib/active_graph/shared/node_query_factory.rb +15 -0
- data/lib/active_graph/shared/persistence.rb +1 -1
- data/lib/active_graph/shared/query_factory.rb +0 -60
- data/lib/active_graph/shared/rel_query_factory.rb +47 -0
- data/lib/active_graph/shared/type_converters.rb +0 -6
- data/lib/active_graph/tasks/migration.rake +0 -4
- data/lib/active_graph/timestamps.rb +0 -3
- data/lib/active_graph/transactions.rb +4 -0
- data/lib/active_graph/version.rb +1 -1
- data/lib/active_graph.rb +36 -119
- data/lib/rails/generators/active_graph/migration/migration_generator.rb +4 -5
- data/lib/rails/generators/active_graph/model/model_generator.rb +4 -5
- data/lib/rails/generators/active_graph/upgrade_v8/upgrade_v8_generator.rb +4 -5
- data/lib/rails/generators/{active_graph_generator.rb → migration_helper.rb} +2 -20
- data/lib/rails/generators/source_path_helper.rb +10 -0
- metadata +27 -34
- data/lib/active_graph/core.rb +0 -14
- data/lib/active_graph/node/node_wrapper.rb +0 -54
- data/lib/active_graph/relationship/rel_wrapper.rb +0 -31
- data/lib/active_graph/wrapper.rb +0 -4
- /data/lib/active_graph/{errors.rb → error.rb} +0 -0
- /data/lib/active_graph/node/query/{query_proxy_link.rb → query_proxy/link.rb} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module ActiveGraph::Shared
|
|
2
|
+
class RelQueryFactory < QueryFactory
|
|
3
|
+
protected
|
|
4
|
+
|
|
5
|
+
def match_string
|
|
6
|
+
"(#{graph_object.from_node_identifier})-[#{identifier}]->()"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_query
|
|
10
|
+
return match_query if graph_object.persisted?
|
|
11
|
+
create_props, set_props = filtered_props
|
|
12
|
+
base_query.send(graph_object.create_method, query_string(create_props)).break
|
|
13
|
+
.set(identifier => set_props)
|
|
14
|
+
.params(params(create_props))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def filtered_props
|
|
20
|
+
ActiveGraph::Shared::FilteredHash.new(graph_object.props_for_create, graph_object.creates_unique_option).filtered_base
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def query_string(create_props)
|
|
24
|
+
"(#{graph_object.from_node_identifier})-[#{identifier}:`#{graph_object.type}` #{pattern(create_props)}]->(#{graph_object.to_node_identifier})"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def params(create_props)
|
|
28
|
+
unique? ? create_props.transform_keys { |key| scoped(key).to_sym } : { namespace.to_sym => create_props }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def unique?
|
|
32
|
+
graph_object.create_method == :create_unique
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def pattern(create_props)
|
|
36
|
+
unique? ? "{#{create_props.keys.map { |key| "#{key}: $#{scoped(key)}" }.join(', ')}}" : "$#{namespace}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def scoped(key)
|
|
40
|
+
"#{namespace}_#{key}"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def namespace
|
|
44
|
+
"#{identifier}_create_props"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
data/lib/active_graph/version.rb
CHANGED
data/lib/active_graph.rb
CHANGED
|
@@ -1,125 +1,42 @@
|
|
|
1
|
+
require 'benchmark'
|
|
2
|
+
require 'bigdecimal'
|
|
3
|
+
require 'bigdecimal/util'
|
|
4
|
+
require 'date'
|
|
1
5
|
require 'forwardable'
|
|
2
|
-
require 'active_graph/version'
|
|
3
|
-
|
|
4
|
-
require 'active_graph/core'
|
|
5
|
-
require 'active_graph/core/query_ext' # From this gem
|
|
6
|
-
|
|
7
|
-
require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
|
8
|
-
require 'active_graph/secure_random_ext'
|
|
9
|
-
require 'active_graph/transactions'
|
|
10
|
-
require 'active_graph/base'
|
|
11
|
-
require 'active_graph/model_schema'
|
|
12
|
-
|
|
13
6
|
require 'active_model'
|
|
14
|
-
require '
|
|
15
|
-
require 'active_support/core_ext/
|
|
16
|
-
require 'active_support/core_ext/class/
|
|
7
|
+
require 'active_model/attribute_set'
|
|
8
|
+
require 'active_support/core_ext/big_decimal/conversions'
|
|
9
|
+
require 'active_support/core_ext/class/attribute'
|
|
10
|
+
require 'active_support/core_ext/class/subclasses'
|
|
17
11
|
require 'active_support/core_ext/module/attribute_accessors'
|
|
12
|
+
require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
|
13
|
+
require 'active_support/core_ext/string/conversions'
|
|
14
|
+
require 'active_support/inflector'
|
|
15
|
+
require 'active_support/inflector/inflections'
|
|
16
|
+
require 'active_support/notifications'
|
|
18
17
|
require 'json'
|
|
19
|
-
|
|
20
|
-
require '
|
|
21
|
-
require '
|
|
22
|
-
require '
|
|
23
|
-
require '
|
|
24
|
-
require '
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
require 'active_graph/undeclared_properties'
|
|
36
|
-
|
|
37
|
-
require 'active_graph/shared/callbacks'
|
|
38
|
-
require 'active_graph/shared/filtered_hash'
|
|
39
|
-
require 'active_graph/shared/declared_property/index'
|
|
40
|
-
require 'active_graph/shared/declared_property'
|
|
41
|
-
require 'active_graph/shared/declared_properties'
|
|
42
|
-
require 'active_graph/shared/enum'
|
|
43
|
-
require 'active_graph/shared/mass_assignment'
|
|
44
|
-
require 'active_graph/shared/attributes'
|
|
45
|
-
require 'active_graph/shared/typecasted_attributes'
|
|
46
|
-
require 'active_graph/shared/property'
|
|
47
|
-
require 'active_graph/shared/persistence'
|
|
48
|
-
require 'active_graph/shared/validations'
|
|
49
|
-
require 'active_graph/shared/identity'
|
|
50
|
-
require 'active_graph/shared/serialized_properties'
|
|
51
|
-
require 'active_graph/shared/typecaster'
|
|
52
|
-
require 'active_graph/shared/initialize'
|
|
53
|
-
require 'active_graph/shared/query_factory'
|
|
54
|
-
require 'active_graph/shared/cypher'
|
|
55
|
-
require 'active_graph/shared/permitted_attributes'
|
|
56
|
-
require 'active_graph/shared'
|
|
57
|
-
|
|
58
|
-
require 'active_graph/relationship/callbacks'
|
|
59
|
-
require 'active_graph/relationship/initialize'
|
|
60
|
-
require 'active_graph/relationship/property'
|
|
61
|
-
require 'active_graph/relationship/persistence/query_factory'
|
|
62
|
-
require 'active_graph/relationship/persistence'
|
|
63
|
-
require 'active_graph/relationship/validations'
|
|
64
|
-
require 'active_graph/relationship/query'
|
|
65
|
-
require 'active_graph/relationship/related_node'
|
|
66
|
-
require 'active_graph/relationship/types'
|
|
67
|
-
require 'active_graph/relationship'
|
|
68
|
-
|
|
69
|
-
require 'active_graph/node/dependent_callbacks'
|
|
70
|
-
require 'active_graph/node/node_list_formatter'
|
|
71
|
-
require 'active_graph/node/dependent'
|
|
72
|
-
require 'active_graph/node/dependent/query_proxy_methods'
|
|
73
|
-
require 'active_graph/node/dependent/association_methods'
|
|
74
|
-
require 'active_graph/node/enum'
|
|
75
|
-
require 'active_graph/node/query_methods'
|
|
76
|
-
require 'active_graph/node/query/query_proxy_methods'
|
|
77
|
-
require 'active_graph/node/query/query_proxy_methods_of_mass_updating'
|
|
78
|
-
require 'active_graph/node/query/query_proxy_enumerable'
|
|
79
|
-
require 'active_graph/node/query/query_proxy_find_in_batches'
|
|
80
|
-
require 'active_graph/node/query/query_proxy_eager_loading'
|
|
81
|
-
require 'active_graph/node/query/query_proxy_eager_loading/association_tree'
|
|
82
|
-
require 'active_graph/node/query/query_proxy_link'
|
|
83
|
-
require 'active_graph/node/labels/index'
|
|
84
|
-
require 'active_graph/node/labels/reloading'
|
|
85
|
-
require 'active_graph/node/labels'
|
|
86
|
-
require 'active_graph/node/id_property/accessor'
|
|
87
|
-
require 'active_graph/node/id_property'
|
|
88
|
-
require 'active_graph/node/callbacks'
|
|
89
|
-
require 'active_graph/node/initialize'
|
|
90
|
-
require 'active_graph/node/property'
|
|
91
|
-
require 'active_graph/node/persistence'
|
|
92
|
-
require 'active_graph/node/validations'
|
|
93
|
-
require 'active_graph/node/rels'
|
|
94
|
-
require 'active_graph/node/reflection'
|
|
95
|
-
require 'active_graph/node/unpersisted'
|
|
96
|
-
require 'active_graph/node/has_n'
|
|
97
|
-
require 'active_graph/node/has_n/association_cypher_methods'
|
|
98
|
-
require 'active_graph/node/has_n/association/rel_wrapper'
|
|
99
|
-
require 'active_graph/node/has_n/association/rel_factory'
|
|
100
|
-
require 'active_graph/node/has_n/association'
|
|
101
|
-
require 'active_graph/node/query/query_proxy'
|
|
102
|
-
require 'active_graph/node/query'
|
|
103
|
-
require 'active_graph/node/scope'
|
|
104
|
-
require 'active_graph/node'
|
|
105
|
-
|
|
106
|
-
require 'active_support/concern'
|
|
107
|
-
require 'active_graph/core/cypher_error'
|
|
108
|
-
require 'active_graph/core/schema_errors'
|
|
109
|
-
|
|
110
|
-
module ActiveGraph
|
|
111
|
-
extend ActiveSupport::Autoload
|
|
112
|
-
autoload :Migrations
|
|
113
|
-
autoload :Migration
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
load 'active_graph/tasks/migration.rake'
|
|
117
|
-
|
|
118
|
-
require 'active_graph/node/orm_adapter'
|
|
119
|
-
if defined?(Rails)
|
|
120
|
-
require 'rails/generators'
|
|
121
|
-
require 'rails/generators/active_graph_generator'
|
|
122
|
-
end
|
|
123
|
-
|
|
18
|
+
require 'neo4j/driver'
|
|
19
|
+
require 'orm_adapter'
|
|
20
|
+
require 'rake'
|
|
21
|
+
require 'set'
|
|
22
|
+
require 'sorted_set'
|
|
23
|
+
require 'yaml'
|
|
24
|
+
|
|
25
|
+
loader = Zeitwerk::Loader.for_gem
|
|
26
|
+
loader.ignore(File.expand_path('rails', __dir__))
|
|
27
|
+
loader.ignore(File.expand_path('active_graph/railtie.rb', __dir__))
|
|
28
|
+
loader.inflector.inflect("ansi" => "ANSI")
|
|
29
|
+
loader.setup
|
|
30
|
+
# loader.eager_load
|
|
31
|
+
|
|
32
|
+
Neo4j::Driver::Result.prepend ActiveGraph::Core::Result
|
|
33
|
+
Neo4j::Driver::Record.prepend ActiveGraph::Core::Record
|
|
124
34
|
Neo4j::Driver::Transaction.prepend ActiveGraph::Transaction
|
|
35
|
+
Neo4j::Driver::Types::Entity.include ActiveGraph::Core::Wrappable
|
|
36
|
+
Neo4j::Driver::Types::Entity.prepend ActiveGraph::Core::Entity
|
|
37
|
+
Neo4j::Driver::Types::Node.prepend ActiveGraph::Core::Node
|
|
38
|
+
Neo4j::Driver::Types::Node.wrapper_callback(&ActiveGraph::Node::Wrapping.method(:wrapper))
|
|
39
|
+
Neo4j::Driver::Types::Relationship.wrapper_callback(&ActiveGraph::Relationship::Wrapping.method(:wrapper))
|
|
125
40
|
SecureRandom.singleton_class.prepend ActiveGraph::SecureRandomExt
|
|
41
|
+
|
|
42
|
+
load 'active_graph/tasks/migration.rake'
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'active_graph.rb')
|
|
1
|
+
require_relative '../../migration_helper'
|
|
2
|
+
require_relative '../../source_path_helper'
|
|
4
3
|
|
|
5
4
|
module ActiveGraph
|
|
6
5
|
module Generators
|
|
7
6
|
class MigrationGenerator < ::Rails::Generators::NamedBase
|
|
8
|
-
include
|
|
9
|
-
include
|
|
7
|
+
include ActiveGraph::Generators::SourcePathHelper
|
|
8
|
+
include ActiveGraph::Generators::MigrationHelper
|
|
10
9
|
|
|
11
10
|
def create_migration_file
|
|
12
11
|
migration_template 'migration.erb'
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'active_graph.rb')
|
|
1
|
+
require_relative '../../migration_helper'
|
|
2
|
+
require_relative '../../source_path_helper'
|
|
4
3
|
|
|
5
4
|
class ActiveGraph::Generators::ModelGenerator < Rails::Generators::NamedBase #:nodoc:
|
|
6
|
-
include
|
|
7
|
-
include
|
|
5
|
+
include ActiveGraph::Generators::SourcePathHelper
|
|
6
|
+
include ActiveGraph::Generators::MigrationHelper
|
|
8
7
|
|
|
9
8
|
argument :attributes, type: :array, default: [], banner: 'field:type field:type'
|
|
10
9
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'active_graph.rb')
|
|
1
|
+
require_relative '../../migration_helper'
|
|
2
|
+
require_relative '../../source_path_helper'
|
|
4
3
|
|
|
5
4
|
module ActiveGraph
|
|
6
5
|
module Generators
|
|
7
6
|
class UpgradeV8Generator < ::Rails::Generators::Base
|
|
8
|
-
include
|
|
9
|
-
include
|
|
7
|
+
include ActiveGraph::Generators::SourcePathHelper
|
|
8
|
+
include ActiveGraph::Generators::MigrationHelper
|
|
10
9
|
|
|
11
10
|
def create_upgrade_v8_file
|
|
12
11
|
@schema = load_all_models_schema!
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails/generators/named_base'
|
|
4
|
-
require 'rails/generators/active_model'
|
|
5
|
-
|
|
6
1
|
module ActiveGraph
|
|
7
2
|
module Generators #:nodoc:
|
|
8
3
|
end
|
|
@@ -55,18 +50,6 @@ module ActiveGraph::Generators::MigrationHelper
|
|
|
55
50
|
end
|
|
56
51
|
end
|
|
57
52
|
|
|
58
|
-
module ActiveGraph::Generators::SourcePathHelper
|
|
59
|
-
extend ActiveSupport::Concern
|
|
60
|
-
|
|
61
|
-
module ClassMethods
|
|
62
|
-
def source_root
|
|
63
|
-
@_neo4j_source_root ||= File.expand_path(File.join(File.dirname(__FILE__),
|
|
64
|
-
'active_graph', generator_name, 'templates'))
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
|
|
70
53
|
class ActiveGraph::Generators::ActiveModel < Rails::Generators::ActiveModel #:nodoc:
|
|
71
54
|
def self.all(klass)
|
|
72
55
|
"#{klass}.all"
|
|
@@ -101,10 +84,9 @@ class ActiveGraph::Generators::ActiveModel < Rails::Generators::ActiveModel #:no
|
|
|
101
84
|
end
|
|
102
85
|
end
|
|
103
86
|
|
|
104
|
-
|
|
105
|
-
module Rails
|
|
87
|
+
module ActiveGraph
|
|
106
88
|
module Generators
|
|
107
|
-
|
|
89
|
+
module GeneratedAttribute #:nodoc:
|
|
108
90
|
def type_class
|
|
109
91
|
case type.to_s.downcase
|
|
110
92
|
when 'any' then 'any'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module ActiveGraph::Generators::SourcePathHelper
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
module ClassMethods
|
|
5
|
+
def source_root
|
|
6
|
+
@_neo4j_source_root ||= File.expand_path(File.join(File.dirname(__FILE__),
|
|
7
|
+
'active_graph', generator_name, 'templates'))
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
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: 11.
|
|
4
|
+
version: 11.5.0.beta.1
|
|
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: 2023-
|
|
11
|
+
date: 2023-12-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -16,28 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '7'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: activesupport
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '4.0'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '4.0'
|
|
26
|
+
version: '7'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: i18n
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,6 +45,9 @@ dependencies:
|
|
|
59
45
|
- - ">="
|
|
60
46
|
- !ruby/object:Gem::Version
|
|
61
47
|
version: 4.4.1
|
|
48
|
+
- - "<"
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '5'
|
|
62
51
|
type: :runtime
|
|
63
52
|
prerelease: false
|
|
64
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -66,18 +55,21 @@ dependencies:
|
|
|
66
55
|
- - ">="
|
|
67
56
|
- !ruby/object:Gem::Version
|
|
68
57
|
version: 4.4.1
|
|
58
|
+
- - "<"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '5'
|
|
69
61
|
- !ruby/object:Gem::Dependency
|
|
70
62
|
name: orm_adapter
|
|
71
63
|
requirement: !ruby/object:Gem::Requirement
|
|
72
64
|
requirements:
|
|
73
|
-
- - "
|
|
65
|
+
- - ">="
|
|
74
66
|
- !ruby/object:Gem::Version
|
|
75
67
|
version: 0.5.0
|
|
76
68
|
type: :runtime
|
|
77
69
|
prerelease: false
|
|
78
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
71
|
requirements:
|
|
80
|
-
- - "
|
|
72
|
+
- - ">="
|
|
81
73
|
- !ruby/object:Gem::Version
|
|
82
74
|
version: 0.5.0
|
|
83
75
|
- !ruby/object:Gem::Dependency
|
|
@@ -184,14 +176,14 @@ dependencies:
|
|
|
184
176
|
requirements:
|
|
185
177
|
- - ">="
|
|
186
178
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: '
|
|
179
|
+
version: '7'
|
|
188
180
|
type: :development
|
|
189
181
|
prerelease: false
|
|
190
182
|
version_requirements: !ruby/object:Gem::Requirement
|
|
191
183
|
requirements:
|
|
192
184
|
- - ">="
|
|
193
185
|
- !ruby/object:Gem::Version
|
|
194
|
-
version: '
|
|
186
|
+
version: '7'
|
|
195
187
|
- !ruby/object:Gem::Dependency
|
|
196
188
|
name: rake
|
|
197
189
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -252,14 +244,14 @@ dependencies:
|
|
|
252
244
|
name: rspec
|
|
253
245
|
requirement: !ruby/object:Gem::Requirement
|
|
254
246
|
requirements:
|
|
255
|
-
- - "
|
|
247
|
+
- - ">="
|
|
256
248
|
- !ruby/object:Gem::Version
|
|
257
249
|
version: '3.10'
|
|
258
250
|
type: :development
|
|
259
251
|
prerelease: false
|
|
260
252
|
version_requirements: !ruby/object:Gem::Requirement
|
|
261
253
|
requirements:
|
|
262
|
-
- - "
|
|
254
|
+
- - ">="
|
|
263
255
|
- !ruby/object:Gem::Version
|
|
264
256
|
version: '3.10'
|
|
265
257
|
description: 'A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
|
|
@@ -287,7 +279,6 @@ files:
|
|
|
287
279
|
- lib/active_graph/base.rb
|
|
288
280
|
- lib/active_graph/class_arguments.rb
|
|
289
281
|
- lib/active_graph/config.rb
|
|
290
|
-
- lib/active_graph/core.rb
|
|
291
282
|
- lib/active_graph/core/cypher_error.rb
|
|
292
283
|
- lib/active_graph/core/entity.rb
|
|
293
284
|
- lib/active_graph/core/instrumentable.rb
|
|
@@ -305,7 +296,7 @@ files:
|
|
|
305
296
|
- lib/active_graph/core/schema.rb
|
|
306
297
|
- lib/active_graph/core/schema_errors.rb
|
|
307
298
|
- lib/active_graph/core/wrappable.rb
|
|
308
|
-
- lib/active_graph/
|
|
299
|
+
- lib/active_graph/error.rb
|
|
309
300
|
- lib/active_graph/lazy_attribute_hash.rb
|
|
310
301
|
- lib/active_graph/migration.rb
|
|
311
302
|
- lib/active_graph/migrations.rb
|
|
@@ -339,17 +330,16 @@ files:
|
|
|
339
330
|
- lib/active_graph/node/labels/index.rb
|
|
340
331
|
- lib/active_graph/node/labels/reloading.rb
|
|
341
332
|
- lib/active_graph/node/node_list_formatter.rb
|
|
342
|
-
- lib/active_graph/node/node_wrapper.rb
|
|
343
333
|
- lib/active_graph/node/orm_adapter.rb
|
|
344
334
|
- lib/active_graph/node/persistence.rb
|
|
345
335
|
- lib/active_graph/node/property.rb
|
|
346
336
|
- lib/active_graph/node/query.rb
|
|
347
337
|
- lib/active_graph/node/query/query_proxy.rb
|
|
338
|
+
- lib/active_graph/node/query/query_proxy/link.rb
|
|
348
339
|
- lib/active_graph/node/query/query_proxy_eager_loading.rb
|
|
349
340
|
- lib/active_graph/node/query/query_proxy_eager_loading/association_tree.rb
|
|
350
341
|
- lib/active_graph/node/query/query_proxy_enumerable.rb
|
|
351
342
|
- lib/active_graph/node/query/query_proxy_find_in_batches.rb
|
|
352
|
-
- lib/active_graph/node/query/query_proxy_link.rb
|
|
353
343
|
- lib/active_graph/node/query/query_proxy_methods.rb
|
|
354
344
|
- lib/active_graph/node/query/query_proxy_methods_of_mass_updating.rb
|
|
355
345
|
- lib/active_graph/node/query_methods.rb
|
|
@@ -358,6 +348,7 @@ files:
|
|
|
358
348
|
- lib/active_graph/node/scope.rb
|
|
359
349
|
- lib/active_graph/node/unpersisted.rb
|
|
360
350
|
- lib/active_graph/node/validations.rb
|
|
351
|
+
- lib/active_graph/node/wrapping.rb
|
|
361
352
|
- lib/active_graph/paginated.rb
|
|
362
353
|
- lib/active_graph/railtie.rb
|
|
363
354
|
- lib/active_graph/relationship.rb
|
|
@@ -367,10 +358,10 @@ files:
|
|
|
367
358
|
- lib/active_graph/relationship/persistence/query_factory.rb
|
|
368
359
|
- lib/active_graph/relationship/property.rb
|
|
369
360
|
- lib/active_graph/relationship/query.rb
|
|
370
|
-
- lib/active_graph/relationship/rel_wrapper.rb
|
|
371
361
|
- lib/active_graph/relationship/related_node.rb
|
|
372
362
|
- lib/active_graph/relationship/types.rb
|
|
373
363
|
- lib/active_graph/relationship/validations.rb
|
|
364
|
+
- lib/active_graph/relationship/wrapping.rb
|
|
374
365
|
- lib/active_graph/schema/operation.rb
|
|
375
366
|
- lib/active_graph/secure_random_ext.rb
|
|
376
367
|
- lib/active_graph/shared.rb
|
|
@@ -386,10 +377,12 @@ files:
|
|
|
386
377
|
- lib/active_graph/shared/initialize.rb
|
|
387
378
|
- lib/active_graph/shared/marshal.rb
|
|
388
379
|
- lib/active_graph/shared/mass_assignment.rb
|
|
380
|
+
- lib/active_graph/shared/node_query_factory.rb
|
|
389
381
|
- lib/active_graph/shared/permitted_attributes.rb
|
|
390
382
|
- lib/active_graph/shared/persistence.rb
|
|
391
383
|
- lib/active_graph/shared/property.rb
|
|
392
384
|
- lib/active_graph/shared/query_factory.rb
|
|
385
|
+
- lib/active_graph/shared/rel_query_factory.rb
|
|
393
386
|
- lib/active_graph/shared/rel_type_converters.rb
|
|
394
387
|
- lib/active_graph/shared/serialized_properties.rb
|
|
395
388
|
- lib/active_graph/shared/type_converters.rb
|
|
@@ -405,7 +398,6 @@ files:
|
|
|
405
398
|
- lib/active_graph/type_converters.rb
|
|
406
399
|
- lib/active_graph/undeclared_properties.rb
|
|
407
400
|
- lib/active_graph/version.rb
|
|
408
|
-
- lib/active_graph/wrapper.rb
|
|
409
401
|
- lib/rails/generators/active_graph/migration/migration_generator.rb
|
|
410
402
|
- lib/rails/generators/active_graph/migration/templates/migration.erb
|
|
411
403
|
- lib/rails/generators/active_graph/model/model_generator.rb
|
|
@@ -413,7 +405,8 @@ files:
|
|
|
413
405
|
- lib/rails/generators/active_graph/model/templates/model.erb
|
|
414
406
|
- lib/rails/generators/active_graph/upgrade_v8/templates/migration.erb
|
|
415
407
|
- lib/rails/generators/active_graph/upgrade_v8/upgrade_v8_generator.rb
|
|
416
|
-
- lib/rails/generators/
|
|
408
|
+
- lib/rails/generators/migration_helper.rb
|
|
409
|
+
- lib/rails/generators/source_path_helper.rb
|
|
417
410
|
homepage: https://github.com/neo4jrb/activegraph/
|
|
418
411
|
licenses:
|
|
419
412
|
- MIT
|
|
@@ -440,11 +433,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
440
433
|
version: '2.6'
|
|
441
434
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
442
435
|
requirements:
|
|
443
|
-
- - "
|
|
436
|
+
- - ">"
|
|
444
437
|
- !ruby/object:Gem::Version
|
|
445
|
-
version:
|
|
438
|
+
version: 1.3.1
|
|
446
439
|
requirements: []
|
|
447
|
-
rubygems_version: 3.3.
|
|
440
|
+
rubygems_version: 3.3.26
|
|
448
441
|
signing_key:
|
|
449
442
|
specification_version: 4
|
|
450
443
|
summary: A graph database for Ruby
|
data/lib/active_graph/core.rb
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require 'active_graph/core/instrumentable'
|
|
2
|
-
require 'active_graph/core/entity'
|
|
3
|
-
require 'active_graph/core/node'
|
|
4
|
-
require 'active_graph/core/query'
|
|
5
|
-
require 'active_graph/core/record'
|
|
6
|
-
require 'active_graph/core/wrappable'
|
|
7
|
-
require 'active_graph/transaction'
|
|
8
|
-
require 'neo4j/driver'
|
|
9
|
-
|
|
10
|
-
Neo4j::Driver::Types::Entity.include ActiveGraph::Core::Wrappable
|
|
11
|
-
Neo4j::Driver::Types::Entity.prepend ActiveGraph::Core::Entity
|
|
12
|
-
Neo4j::Driver::Types::Node.prepend ActiveGraph::Core::Node
|
|
13
|
-
Neo4j::Driver::Result.prepend ActiveGraph::Core::Result
|
|
14
|
-
Neo4j::Driver::Record.prepend ActiveGraph::Core::Record
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require 'active_support/inflector'
|
|
2
|
-
require 'active_graph/core/node'
|
|
3
|
-
|
|
4
|
-
wrapping_proc = proc do |node|
|
|
5
|
-
found_class = ActiveGraph::NodeWrapping.class_to_wrap(node.labels)
|
|
6
|
-
next node if not found_class
|
|
7
|
-
|
|
8
|
-
found_class.new.tap do |wrapped_node|
|
|
9
|
-
wrapped_node.init_on_load(node, node.properties)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
Neo4j::Driver::Types::Node.wrapper_callback(wrapping_proc)
|
|
13
|
-
|
|
14
|
-
module ActiveGraph
|
|
15
|
-
module NodeWrapping
|
|
16
|
-
# Only load classes once for performance
|
|
17
|
-
CONSTANTS_FOR_LABELS_CACHE = {}
|
|
18
|
-
|
|
19
|
-
class << self
|
|
20
|
-
def class_to_wrap(labels)
|
|
21
|
-
load_classes_from_labels(labels)
|
|
22
|
-
ActiveGraph::Node::Labels.model_for_labels(labels).tap do |model_class|
|
|
23
|
-
populate_constants_for_labels_cache(model_class, labels)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
def load_classes_from_labels(labels)
|
|
30
|
-
labels.each { |label| constant_for_label(label) }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def constant_for_label(label)
|
|
34
|
-
CONSTANTS_FOR_LABELS_CACHE[label] || CONSTANTS_FOR_LABELS_CACHE[label] = constantized_label(label)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def constantized_label(label)
|
|
38
|
-
"#{association_model_namespace}::#{label}".constantize
|
|
39
|
-
rescue NameError, LoadError
|
|
40
|
-
nil
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def populate_constants_for_labels_cache(model_class, labels)
|
|
44
|
-
labels.each do |label|
|
|
45
|
-
CONSTANTS_FOR_LABELS_CACHE[label] = model_class if CONSTANTS_FOR_LABELS_CACHE[label].nil?
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def association_model_namespace
|
|
50
|
-
ActiveGraph::Config.association_model_namespace_string
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
wrapping_proc = proc do |relationship|
|
|
4
|
-
ActiveGraph::RelWrapping.wrapper(relationship)
|
|
5
|
-
end
|
|
6
|
-
Neo4j::Driver::Types::Relationship.wrapper_callback(wrapping_proc)
|
|
7
|
-
|
|
8
|
-
module ActiveGraph
|
|
9
|
-
module RelWrapping
|
|
10
|
-
class << self
|
|
11
|
-
def wrapper(rel)
|
|
12
|
-
rel.properties.symbolize_keys!
|
|
13
|
-
begin
|
|
14
|
-
most_concrete_class = class_from_type(rel.type).constantize
|
|
15
|
-
return rel unless most_concrete_class < ActiveGraph::Relationship
|
|
16
|
-
most_concrete_class.new
|
|
17
|
-
rescue NameError => e
|
|
18
|
-
raise e unless e.message =~ /(uninitialized|wrong) constant/
|
|
19
|
-
|
|
20
|
-
return rel
|
|
21
|
-
end.tap do |wrapped_rel|
|
|
22
|
-
wrapped_rel.init_on_load(rel, rel.start_node_id, rel.end_node_id, rel.type)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def class_from_type(type)
|
|
27
|
-
ActiveGraph::Relationship::Types::WRAPPED_CLASSES[type] || ActiveGraph::Relationship::Types::WRAPPED_CLASSES[type] = type.to_s.downcase.camelize
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|