neo4j 8.3.4 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -17
- data/lib/neo4j/active_node/query/query_proxy.rb +1 -3
- data/lib/neo4j/active_node/query/query_proxy_eager_loading.rb +1 -6
- data/lib/neo4j/active_node/query/query_proxy_methods.rb +0 -4
- data/lib/neo4j/config.rb +4 -0
- data/lib/neo4j/shared/enum.rb +27 -7
- data/lib/neo4j/shared/type_converters.rb +9 -1
- data/lib/neo4j/tasks/migration.rake +1 -1
- data/lib/neo4j/version.rb +1 -1
- data/neo4j.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c78f6fb58c6a6a78a3fb7e270ffd739ae12e308b
|
4
|
+
data.tar.gz: 7594112b8478cca3a2a8be8c8466a3857e1f26d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41a2702fbfba425b8f56a68ad6cf3eb6c2caafa65b7b59274df602b0db61c75ea2d66ba6be7d08a68464f7f5b69685fc803445a6720c12559cab71e386050d49
|
7
|
+
data.tar.gz: ccd313d1f0c9ded6b4ed0512e5f7c6aeefca38450f9b69500d9551440f7aebab9e13cc9c861e872538a18243ba2fe796a617802f47066ebf4265adbd77a9ef96
|
data/CHANGELOG.md
CHANGED
@@ -3,27 +3,15 @@ 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
|
-
## [
|
6
|
+
## [9.0.0] 2017-09-26
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
- Ensure `branch` and `with_association` methods propagate `distinct` (thanks @klobuczek / see #1438)
|
11
|
-
|
12
|
-
## [8.3.3] 2017-10-15
|
13
|
-
|
14
|
-
## Fixes
|
15
|
-
|
16
|
-
- Change YAML.safe_load call in `neo4j:schema:load` rake task to allow Symbols (thanks @evanob / see #1439)
|
17
|
-
|
18
|
-
## [8.3.2] 2017-10-12
|
19
|
-
|
20
|
-
## Fixes
|
8
|
+
### Changed
|
21
9
|
|
22
|
-
-
|
10
|
+
- `enum` values are now case-insensitive when being set by default (with a `_case_sensitive` option) (thanks @thefliik / see #1419)
|
23
11
|
|
24
|
-
|
12
|
+
### Fixed
|
25
13
|
|
26
|
-
-
|
14
|
+
- Properties defined on a superclass after the subclass has been defined will now take effect on the subclass (thanks @thefliik / see #1428)
|
27
15
|
|
28
16
|
## [8.3.0] 2017-09-25
|
29
17
|
|
@@ -187,9 +187,7 @@ module Neo4j
|
|
187
187
|
# `as(identity)` is here to make sure we get the right variable
|
188
188
|
# There might be a deeper problem of the variable changing when we
|
189
189
|
# traverse an association
|
190
|
-
as(identity).instance_eval(&block).query.proxy_as(self.model, identity)
|
191
|
-
propagate_context(new_query_proxy)
|
192
|
-
end
|
190
|
+
as(identity).instance_eval(&block).query.proxy_as(self.model, identity)
|
193
191
|
end
|
194
192
|
|
195
193
|
def [](index)
|
@@ -73,11 +73,6 @@ module Neo4j
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
def propagate_context(query_proxy)
|
77
|
-
super
|
78
|
-
query_proxy.instance_variable_set('@with_associations_tree', @with_associations_tree)
|
79
|
-
end
|
80
|
-
|
81
76
|
def with_associations_tree
|
82
77
|
@with_associations_tree ||= AssociationTree.new(model)
|
83
78
|
end
|
@@ -143,7 +138,7 @@ module Neo4j
|
|
143
138
|
|
144
139
|
def query_from_association_tree
|
145
140
|
previous_with_variables = []
|
146
|
-
with_associations_tree.paths.inject(query_as(identity).with(
|
141
|
+
with_associations_tree.paths.inject(query_as(identity).with(identity)) do |query, path|
|
147
142
|
with_association_query_part(query, path, previous_with_variables).tap do
|
148
143
|
previous_with_variables << path_name(path)
|
149
144
|
end
|
@@ -47,10 +47,6 @@ module Neo4j
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def propagate_context(query_proxy)
|
51
|
-
query_proxy.instance_variable_set(:@distinct, @distinct)
|
52
|
-
end
|
53
|
-
|
54
50
|
# @return [Integer] number of nodes of this class
|
55
51
|
def count(distinct = nil, target = nil)
|
56
52
|
return 0 if unpersisted_start_object?
|
data/lib/neo4j/config.rb
CHANGED
data/lib/neo4j/shared/enum.rb
CHANGED
@@ -3,6 +3,7 @@ module Neo4j::Shared
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
class ConflictingEnumMethodError < Neo4j::Error; end
|
6
|
+
class InvalidEnumValueError < Neo4j::InvalidParameterError; end
|
6
7
|
|
7
8
|
module ClassMethods
|
8
9
|
attr_reader :neo4j_enum_data
|
@@ -43,7 +44,7 @@ module Neo4j::Shared
|
|
43
44
|
def enum(parameters = {})
|
44
45
|
options, parameters = *split_options_and_parameters(parameters)
|
45
46
|
parameters.each do |property_name, enum_keys|
|
46
|
-
enum_keys = normalize_key_list enum_keys
|
47
|
+
enum_keys = normalize_key_list enum_keys, options
|
47
48
|
@neo4j_enum_data ||= {}
|
48
49
|
@neo4j_enum_data[property_name] = enum_keys
|
49
50
|
define_property(property_name, enum_keys, options)
|
@@ -53,18 +54,28 @@ module Neo4j::Shared
|
|
53
54
|
|
54
55
|
protected
|
55
56
|
|
56
|
-
def normalize_key_list(enum_keys)
|
57
|
+
def normalize_key_list(enum_keys, options)
|
58
|
+
case_sensitive = options.fetch(:_case_sensitive, Neo4j::Config.enums_case_sensitive)
|
59
|
+
|
57
60
|
case enum_keys
|
58
61
|
when Hash
|
59
62
|
enum_keys
|
60
63
|
when Array
|
61
|
-
Hash[enum_keys.each_with_index.to_a]
|
64
|
+
enum_keys = Hash[enum_keys.each_with_index.to_a]
|
62
65
|
else
|
63
66
|
fail ArgumentError, 'Invalid parameter for enum. Please provide an Array or an Hash.'
|
64
67
|
end
|
68
|
+
|
69
|
+
unless case_sensitive
|
70
|
+
enum_keys.keys.each do |key|
|
71
|
+
fail ArgumentError, 'Enum keys must be lowercase unless _case_sensitive = true' unless key.downcase == key
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
enum_keys
|
65
76
|
end
|
66
77
|
|
67
|
-
VALID_OPTIONS_FOR_ENUMS = [:_index, :_prefix, :_suffix, :_default]
|
78
|
+
VALID_OPTIONS_FOR_ENUMS = [:_index, :_prefix, :_suffix, :_default, :_case_sensitive]
|
68
79
|
|
69
80
|
def split_options_and_parameters(parameters)
|
70
81
|
options = {}
|
@@ -80,9 +91,8 @@ module Neo4j::Shared
|
|
80
91
|
end
|
81
92
|
|
82
93
|
def define_property(property_name, enum_keys, options)
|
83
|
-
|
84
|
-
|
85
|
-
serialize property_name, Neo4j::Shared::TypeConverters::EnumConverter.new(enum_keys, property_options)
|
94
|
+
property property_name, build_property_options(enum_keys, options)
|
95
|
+
serialize property_name, Neo4j::Shared::TypeConverters::EnumConverter.new(enum_keys, build_enum_options(enum_keys, options))
|
86
96
|
end
|
87
97
|
|
88
98
|
def build_property_options(_enum_keys, options = {})
|
@@ -91,6 +101,16 @@ module Neo4j::Shared
|
|
91
101
|
}
|
92
102
|
end
|
93
103
|
|
104
|
+
def build_enum_options(enum_keys, options = {})
|
105
|
+
if options[:_default] && not(enum_keys.include?(options[:_default]))
|
106
|
+
fail ArgumentError, 'Enum default value must match an enum key'
|
107
|
+
end
|
108
|
+
|
109
|
+
build_property_options(enum_keys, options).tap do |enum_options|
|
110
|
+
enum_options[:case_sensitive] = options[:_case_sensitive]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
94
114
|
def define_enum_methods(property_name, enum_keys, options)
|
95
115
|
define_enum_methods_?(property_name, enum_keys, options)
|
96
116
|
define_enum_methods_!(property_name, enum_keys, options)
|
@@ -271,6 +271,10 @@ module Neo4j::Shared
|
|
271
271
|
def initialize(enum_keys, options)
|
272
272
|
@enum_keys = enum_keys
|
273
273
|
@options = options
|
274
|
+
|
275
|
+
return unless @options[:case_sensitive].nil?
|
276
|
+
|
277
|
+
@options[:case_sensitive] = Neo4j::Config.enums_case_sensitive
|
274
278
|
end
|
275
279
|
|
276
280
|
def converted?(value)
|
@@ -298,8 +302,12 @@ module Neo4j::Shared
|
|
298
302
|
def to_db(value)
|
299
303
|
if value.is_a?(Array)
|
300
304
|
value.map(&method(:to_db))
|
305
|
+
elsif @options[:case_sensitive]
|
306
|
+
@enum_keys[value.to_s.to_sym] ||
|
307
|
+
fail(Neo4j::Shared::Enum::InvalidEnumValueError, 'Value passed to an enum property must match one of the enum keys')
|
301
308
|
else
|
302
|
-
@enum_keys[value.to_s.to_sym] ||
|
309
|
+
@enum_keys[value.to_s.downcase.to_sym] ||
|
310
|
+
fail(Neo4j::Shared::Enum::InvalidEnumValueError, 'Case-insensitive (downcased) value passed to an enum property must match one of the enum keys')
|
303
311
|
end
|
304
312
|
end
|
305
313
|
end
|
@@ -95,7 +95,7 @@ COMMENT
|
|
95
95
|
|
96
96
|
args.with_defaults(remove_missing: false)
|
97
97
|
|
98
|
-
schema_data = YAML.safe_load(File.read(SCHEMA_YAML_PATH)
|
98
|
+
schema_data = YAML.safe_load(File.read(SCHEMA_YAML_PATH))
|
99
99
|
|
100
100
|
Neo4j::Core::CypherSession::Adaptors::Base.subscribe_to_query(&method(:puts))
|
101
101
|
|
data/lib/neo4j/version.rb
CHANGED
data/neo4j.gemspec
CHANGED
@@ -41,5 +41,4 @@ A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
|
|
41
41
|
s.add_development_dependency('guard-rubocop')
|
42
42
|
s.add_development_dependency('guard-rspec')
|
43
43
|
s.add_development_dependency('rubocop', '~> 0.49.1')
|
44
|
-
s.add_development_dependency('neo4j-rake_tasks', '>= 0.3.0')
|
45
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Brian Underwood, Chris Grigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: orm_adapter
|
@@ -192,20 +192,6 @@ dependencies:
|
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 0.49.1
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: neo4j-rake_tasks
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: 0.3.0
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: 0.3.0
|
209
195
|
description: 'A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
|
210
196
|
|
211
197
|
'
|