activegraph 11.4.0 → 11.5.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/activegraph.gemspec +3 -3
  4. data/lib/active_graph/attribute_set.rb +0 -4
  5. data/lib/active_graph/base.rb +0 -3
  6. data/lib/active_graph/config.rb +0 -1
  7. data/lib/active_graph/core/instrumentable.rb +0 -5
  8. data/lib/active_graph/core/querable.rb +0 -5
  9. data/lib/active_graph/core/query.rb +4 -7
  10. data/lib/active_graph/core/query_ext.rb +1 -1
  11. data/lib/active_graph/core/record.rb +0 -5
  12. data/lib/active_graph/core/result.rb +5 -0
  13. data/lib/active_graph/core/wrappable.rb +1 -1
  14. data/lib/active_graph/generators/active_model.rb +33 -0
  15. data/lib/active_graph/generators/generated_attribute.rb +17 -0
  16. data/lib/{rails/generators/active_graph/migration → active_graph/generators}/migration_generator.rb +0 -4
  17. data/lib/{rails/generators/active_graph_generator.rb → active_graph/generators/migration_helper.rb} +0 -75
  18. data/lib/{rails/generators/active_graph/model → active_graph/generators}/model_generator.rb +0 -4
  19. data/lib/active_graph/generators/source_path_helper.rb +10 -0
  20. data/lib/{rails/generators/active_graph/upgrade_v8 → active_graph/generators}/upgrade_v8_generator.rb +0 -4
  21. data/lib/active_graph/lazy_attribute_hash.rb +0 -2
  22. data/lib/active_graph/migration.rb +0 -3
  23. data/lib/active_graph/migrations/helpers.rb +0 -7
  24. data/lib/active_graph/migrations/runner.rb +0 -4
  25. data/lib/active_graph/migrations.rb +0 -8
  26. data/lib/active_graph/model_schema.rb +0 -1
  27. data/lib/active_graph/node/has_n/association.rb +0 -3
  28. data/lib/active_graph/node/labels.rb +1 -3
  29. data/lib/active_graph/node/orm_adapter.rb +0 -6
  30. data/lib/active_graph/node/scope.rb +4 -43
  31. data/lib/active_graph/node/wrapping.rb +52 -0
  32. data/lib/active_graph/node.rb +1 -0
  33. data/lib/active_graph/railtie.rb +0 -6
  34. data/lib/active_graph/relationship/property.rb +0 -2
  35. data/lib/active_graph/relationship/wrapping.rb +26 -0
  36. data/lib/active_graph/shared/attributes.rb +3 -2
  37. data/lib/active_graph/shared/node_query_factory.rb +15 -0
  38. data/lib/active_graph/shared/persistence.rb +1 -1
  39. data/lib/active_graph/shared/query_factory.rb +0 -60
  40. data/lib/active_graph/shared/rel_query_factory.rb +47 -0
  41. data/lib/active_graph/shared/type_converters.rb +0 -6
  42. data/lib/active_graph/tasks/migration.rake +0 -4
  43. data/lib/active_graph/timestamps.rb +0 -3
  44. data/lib/active_graph/version.rb +1 -1
  45. data/lib/active_graph.rb +43 -114
  46. metadata +32 -23
  47. data/lib/active_graph/core.rb +0 -14
  48. data/lib/active_graph/node/node_wrapper.rb +0 -54
  49. data/lib/active_graph/relationship/rel_wrapper.rb +0 -31
  50. data/lib/active_graph/wrapper.rb +0 -4
  51. /data/lib/active_graph/{errors.rb → error.rb} +0 -0
  52. /data/lib/{rails/generators/active_graph → active_graph/generators}/migration/templates/migration.erb +0 -0
  53. /data/lib/{rails/generators/active_graph → active_graph/generators}/model/templates/migration.erb +0 -0
  54. /data/lib/{rails/generators/active_graph → active_graph/generators}/model/templates/model.erb +0 -0
  55. /data/lib/{rails/generators/active_graph → active_graph/generators}/upgrade_v8/templates/migration.erb +0 -0
  56. /data/lib/active_graph/node/query/{query_proxy_link.rb → query_proxy/link.rb} +0 -0
@@ -217,7 +217,7 @@ module ActiveGraph::Shared
217
217
  if self.new_record?
218
218
  "#{model_cache_key}/new"
219
219
  elsif self.respond_to?(:updated_at) && !self.updated_at.blank?
220
- "#{model_cache_key}/#{neo_id}-#{self.updated_at.utc.to_s(:number)}"
220
+ "#{model_cache_key}/#{neo_id}-#{self.updated_at.utc.to_fs(:number)}"
221
221
  else
222
222
  "#{model_cache_key}/#{neo_id}"
223
223
  end
@@ -59,64 +59,4 @@ module ActiveGraph::Shared
59
59
  @identifier_params ||= "#{identifier}_params"
60
60
  end
61
61
  end
62
-
63
- class NodeQueryFactory < QueryFactory
64
- protected
65
-
66
- def match_string
67
- "(#{identifier})"
68
- end
69
-
70
- def create_query
71
- return match_query if graph_object.persisted?
72
- labels = graph_object.labels_for_create.map { |l| ":`#{l}`" }.join
73
- base_query.create("(#{identifier}#{labels} $#{identifier}_params)").params(identifier_params => graph_object.props_for_create)
74
- end
75
- end
76
-
77
- class RelQueryFactory < QueryFactory
78
- protected
79
-
80
- def match_string
81
- "(#{graph_object.from_node_identifier})-[#{identifier}]->()"
82
- end
83
-
84
- def create_query
85
- return match_query if graph_object.persisted?
86
- create_props, set_props = filtered_props
87
- base_query.send(graph_object.create_method, query_string(create_props)).break
88
- .set(identifier => set_props)
89
- .params(params(create_props))
90
- end
91
-
92
- private
93
-
94
- def filtered_props
95
- ActiveGraph::Shared::FilteredHash.new(graph_object.props_for_create, graph_object.creates_unique_option).filtered_base
96
- end
97
-
98
- def query_string(create_props)
99
- "(#{graph_object.from_node_identifier})-[#{identifier}:`#{graph_object.type}` #{pattern(create_props)}]->(#{graph_object.to_node_identifier})"
100
- end
101
-
102
- def params(create_props)
103
- unique? ? create_props.transform_keys { |key| scoped(key).to_sym } : { namespace.to_sym => create_props }
104
- end
105
-
106
- def unique?
107
- graph_object.create_method == :create_unique
108
- end
109
-
110
- def pattern(create_props)
111
- unique? ? "{#{create_props.keys.map { |key| "#{key}: $#{scoped(key)}" }.join(', ')}}" : "$#{namespace}"
112
- end
113
-
114
- def scoped(key)
115
- "#{namespace}_#{key}"
116
- end
117
-
118
- def namespace
119
- "#{identifier}_create_props"
120
- end
121
- end
122
62
  end
@@ -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
@@ -1,9 +1,3 @@
1
- require 'date'
2
- require 'bigdecimal'
3
- require 'bigdecimal/util'
4
- require 'active_support/core_ext/big_decimal/conversions'
5
- require 'active_support/core_ext/string/conversions'
6
-
7
1
  module ActiveGraph::Shared
8
2
  class Boolean; end
9
3
 
@@ -1,7 +1,3 @@
1
- require 'rake'
2
- require 'active_support/concern'
3
- require 'active_graph/migration'
4
-
5
1
  if !defined?(Rails) && !Rake::Task.task_defined?('environment')
6
2
  desc 'Run a script against the database to perform system-wide changes'
7
3
  task :environment do
@@ -1,6 +1,3 @@
1
- require 'active_graph/timestamps/created'
2
- require 'active_graph/timestamps/updated'
3
-
4
1
  module ActiveGraph
5
2
  # This mixin includes timestamps in the included class
6
3
  module Timestamps
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '11.4.0'
2
+ VERSION = '11.5.0.alpha.1'
3
3
  end
data/lib/active_graph.rb CHANGED
@@ -1,125 +1,54 @@
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 'active_support/concern'
15
- require 'active_support/core_ext/class/attribute.rb'
16
- require 'active_support/core_ext/class/subclasses.rb'
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'
18
+ require 'neo4j/driver'
19
+ require 'orm_adapter'
20
+ require 'rake'
21
+ require 'set'
22
+ require 'sorted_set'
23
+ require 'yaml'
19
24
 
20
- require 'active_graph/lazy_attribute_hash'
21
- require 'active_graph/attribute_set'
22
- require 'active_graph/errors'
23
- require 'active_graph/config'
24
- require 'active_graph/wrapper'
25
- require 'active_graph/relationship/rel_wrapper'
26
- require 'active_graph/node/node_wrapper'
27
- require 'active_graph/shared/type_converters'
28
- require 'active_graph/shared/rel_type_converters'
29
- require 'active_graph/shared/marshal'
30
- require 'active_graph/type_converters'
31
- require 'active_graph/paginated'
32
- require 'active_graph/schema/operation'
33
-
34
- require 'active_graph/timestamps'
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
25
  if defined?(Rails)
26
+ # Need the action_dispatch railtie to have action_dispatch.rescue_responses initialized correctly
27
+ require 'action_dispatch/railtie'
120
28
  require 'rails/generators'
121
- require 'rails/generators/active_graph_generator'
29
+ require 'rails/generators/active_model'
30
+ require 'rails/generators/named_base'
31
+ require 'rails/railtie'
122
32
  end
123
33
 
34
+ loader = Zeitwerk::Loader.for_gem
35
+ unless defined?(Rails)
36
+ loader.ignore(File.expand_path('active_graph/generators', __dir__))
37
+ loader.ignore(File.expand_path('active_graph/railtie.rb', __dir__))
38
+ end
39
+ loader.inflector.inflect("ansi" => "ANSI")
40
+ loader.setup
41
+ # loader.eager_load
42
+
43
+ Neo4j::Driver::Result.prepend ActiveGraph::Core::Result
44
+ Neo4j::Driver::Record.prepend ActiveGraph::Core::Record
124
45
  Neo4j::Driver::Transaction.prepend ActiveGraph::Transaction
46
+ Neo4j::Driver::Types::Entity.include ActiveGraph::Core::Wrappable
47
+ Neo4j::Driver::Types::Entity.prepend ActiveGraph::Core::Entity
48
+ Neo4j::Driver::Types::Node.prepend ActiveGraph::Core::Node
49
+ Neo4j::Driver::Types::Node.wrapper_callback(&ActiveGraph::Node::Wrapping.method(:wrapper))
50
+ Neo4j::Driver::Types::Relationship.wrapper_callback(&ActiveGraph::Relationship::Wrapping.method(:wrapper))
125
51
  SecureRandom.singleton_class.prepend ActiveGraph::SecureRandomExt
52
+ Rails::Generators::GeneratedAttribute.include ActiveGraph::Generators::GeneratedAttribute if defined?(Rails)
53
+
54
+ load 'active_graph/tasks/migration.rake'
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.0
4
+ version: 11.5.0.alpha.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-09-05 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -59,6 +59,9 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 4.4.1
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '5'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,18 +69,21 @@ dependencies:
66
69
  - - ">="
67
70
  - !ruby/object:Gem::Version
68
71
  version: 4.4.1
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '5'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: orm_adapter
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - "~>"
79
+ - - ">="
74
80
  - !ruby/object:Gem::Version
75
81
  version: 0.5.0
76
82
  type: :runtime
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - "~>"
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: 0.5.0
83
89
  - !ruby/object:Gem::Dependency
@@ -252,14 +258,14 @@ dependencies:
252
258
  name: rspec
253
259
  requirement: !ruby/object:Gem::Requirement
254
260
  requirements:
255
- - - "<"
261
+ - - ">="
256
262
  - !ruby/object:Gem::Version
257
263
  version: '3.10'
258
264
  type: :development
259
265
  prerelease: false
260
266
  version_requirements: !ruby/object:Gem::Requirement
261
267
  requirements:
262
- - - "<"
268
+ - - ">="
263
269
  - !ruby/object:Gem::Version
264
270
  version: '3.10'
265
271
  description: 'A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
@@ -287,7 +293,6 @@ files:
287
293
  - lib/active_graph/base.rb
288
294
  - lib/active_graph/class_arguments.rb
289
295
  - lib/active_graph/config.rb
290
- - lib/active_graph/core.rb
291
296
  - lib/active_graph/core/cypher_error.rb
292
297
  - lib/active_graph/core/entity.rb
293
298
  - lib/active_graph/core/instrumentable.rb
@@ -305,7 +310,18 @@ files:
305
310
  - lib/active_graph/core/schema.rb
306
311
  - lib/active_graph/core/schema_errors.rb
307
312
  - lib/active_graph/core/wrappable.rb
308
- - lib/active_graph/errors.rb
313
+ - lib/active_graph/error.rb
314
+ - lib/active_graph/generators/active_model.rb
315
+ - lib/active_graph/generators/generated_attribute.rb
316
+ - lib/active_graph/generators/migration/templates/migration.erb
317
+ - lib/active_graph/generators/migration_generator.rb
318
+ - lib/active_graph/generators/migration_helper.rb
319
+ - lib/active_graph/generators/model/templates/migration.erb
320
+ - lib/active_graph/generators/model/templates/model.erb
321
+ - lib/active_graph/generators/model_generator.rb
322
+ - lib/active_graph/generators/source_path_helper.rb
323
+ - lib/active_graph/generators/upgrade_v8/templates/migration.erb
324
+ - lib/active_graph/generators/upgrade_v8_generator.rb
309
325
  - lib/active_graph/lazy_attribute_hash.rb
310
326
  - lib/active_graph/migration.rb
311
327
  - lib/active_graph/migrations.rb
@@ -339,17 +355,16 @@ files:
339
355
  - lib/active_graph/node/labels/index.rb
340
356
  - lib/active_graph/node/labels/reloading.rb
341
357
  - lib/active_graph/node/node_list_formatter.rb
342
- - lib/active_graph/node/node_wrapper.rb
343
358
  - lib/active_graph/node/orm_adapter.rb
344
359
  - lib/active_graph/node/persistence.rb
345
360
  - lib/active_graph/node/property.rb
346
361
  - lib/active_graph/node/query.rb
347
362
  - lib/active_graph/node/query/query_proxy.rb
363
+ - lib/active_graph/node/query/query_proxy/link.rb
348
364
  - lib/active_graph/node/query/query_proxy_eager_loading.rb
349
365
  - lib/active_graph/node/query/query_proxy_eager_loading/association_tree.rb
350
366
  - lib/active_graph/node/query/query_proxy_enumerable.rb
351
367
  - lib/active_graph/node/query/query_proxy_find_in_batches.rb
352
- - lib/active_graph/node/query/query_proxy_link.rb
353
368
  - lib/active_graph/node/query/query_proxy_methods.rb
354
369
  - lib/active_graph/node/query/query_proxy_methods_of_mass_updating.rb
355
370
  - lib/active_graph/node/query_methods.rb
@@ -358,6 +373,7 @@ files:
358
373
  - lib/active_graph/node/scope.rb
359
374
  - lib/active_graph/node/unpersisted.rb
360
375
  - lib/active_graph/node/validations.rb
376
+ - lib/active_graph/node/wrapping.rb
361
377
  - lib/active_graph/paginated.rb
362
378
  - lib/active_graph/railtie.rb
363
379
  - lib/active_graph/relationship.rb
@@ -367,10 +383,10 @@ files:
367
383
  - lib/active_graph/relationship/persistence/query_factory.rb
368
384
  - lib/active_graph/relationship/property.rb
369
385
  - lib/active_graph/relationship/query.rb
370
- - lib/active_graph/relationship/rel_wrapper.rb
371
386
  - lib/active_graph/relationship/related_node.rb
372
387
  - lib/active_graph/relationship/types.rb
373
388
  - lib/active_graph/relationship/validations.rb
389
+ - lib/active_graph/relationship/wrapping.rb
374
390
  - lib/active_graph/schema/operation.rb
375
391
  - lib/active_graph/secure_random_ext.rb
376
392
  - lib/active_graph/shared.rb
@@ -386,10 +402,12 @@ files:
386
402
  - lib/active_graph/shared/initialize.rb
387
403
  - lib/active_graph/shared/marshal.rb
388
404
  - lib/active_graph/shared/mass_assignment.rb
405
+ - lib/active_graph/shared/node_query_factory.rb
389
406
  - lib/active_graph/shared/permitted_attributes.rb
390
407
  - lib/active_graph/shared/persistence.rb
391
408
  - lib/active_graph/shared/property.rb
392
409
  - lib/active_graph/shared/query_factory.rb
410
+ - lib/active_graph/shared/rel_query_factory.rb
393
411
  - lib/active_graph/shared/rel_type_converters.rb
394
412
  - lib/active_graph/shared/serialized_properties.rb
395
413
  - lib/active_graph/shared/type_converters.rb
@@ -405,15 +423,6 @@ files:
405
423
  - lib/active_graph/type_converters.rb
406
424
  - lib/active_graph/undeclared_properties.rb
407
425
  - lib/active_graph/version.rb
408
- - lib/active_graph/wrapper.rb
409
- - lib/rails/generators/active_graph/migration/migration_generator.rb
410
- - lib/rails/generators/active_graph/migration/templates/migration.erb
411
- - lib/rails/generators/active_graph/model/model_generator.rb
412
- - lib/rails/generators/active_graph/model/templates/migration.erb
413
- - lib/rails/generators/active_graph/model/templates/model.erb
414
- - lib/rails/generators/active_graph/upgrade_v8/templates/migration.erb
415
- - lib/rails/generators/active_graph/upgrade_v8/upgrade_v8_generator.rb
416
- - lib/rails/generators/active_graph_generator.rb
417
426
  homepage: https://github.com/neo4jrb/activegraph/
418
427
  licenses:
419
428
  - MIT
@@ -440,11 +449,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
440
449
  version: '2.6'
441
450
  required_rubygems_version: !ruby/object:Gem::Requirement
442
451
  requirements:
443
- - - ">="
452
+ - - ">"
444
453
  - !ruby/object:Gem::Version
445
- version: '0'
454
+ version: 1.3.1
446
455
  requirements: []
447
- rubygems_version: 3.3.7
456
+ rubygems_version: 3.3.26
448
457
  signing_key:
449
458
  specification_version: 4
450
459
  summary: A graph database for Ruby
@@ -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
@@ -1,4 +0,0 @@
1
- module ActiveGraph
2
- module ClassWrapper
3
- end
4
- end
File without changes